How to use WIX to deploy and run WCF service - wcf

I am trying to make an installer which deploys my wcf service, at the moment it is creating the virtual directory, but when I try connect my app to it, I get a
CommunicationException was unhandled
by user code The remote server
returned an error: NotFound.
I notice that if I create a virtual directory manually that it will connect and work, so I'm assuming IIS is doing something behind my back which is making it work.
This is the code I am using to create the virtual directory,please note this is inside a iis:WebSite tag if more information is needed please let me know.
<iis:WebVirtualDir Id="VAWebService" Directory="VAWebService" Alias="VAWebService">
<iis:WebApplication Id="VAWebService" Name="VAWebService"
AllowSessions="yes" WebAppPool="VA_AppPool" />
<iis:WebDirProperties Id="MyWebSite_Properties" AnonymousAccess="yes"
WindowsAuthentication="no" DefaultDocuments="service1.svc"
AccessSSL="yes" AccessSSL128="yes" AccessSSLMapCert="yes"
AccessSSLNegotiateCert="yes" AccessSSLRequireCert="yes"
Read="yes" Write="yes" Execute="yes" Script="yes" />
</iis:WebVirtualDir>
Does any one know how to fix this? any help would be appreciated.
Thanks

I'm pretty sure you don't need Write or Execute set to yes. You probably don't need AccessSSLMapCert or AccessSSLNegotiateCert or AccessSSLRequireCert either, unless you are using client certificates to authenticate to the site. Are you setting these when you configure the site using IIS?

Related

Service Fabric ApplicationManifest parameterized certificaterefs?

I have a solution with multiple SF services. Some of them use HTTPS endpoints, so I have these specs (details hidden or changed)
We are several developers, and we are using self-signed certificates for local deployment.
<Parameters>
<Parameter Name="Api_SslCertHash" DefaultValue="<my-thumbprint-here!>" />
</Parameters>
and
<ServiceManifestImport>
<ServiceManifestRef ServiceManifestName="SomeAppPkg" ServiceManifestVersion="1.0.0" />
<Policies>
<EndpointBindingPolicy EndpointRef="ServiceEndpointHttps" CertificateRef="mycert" />
</Policies>
</ServiceManifestImport>
and then
<Certificates>
<EndpointCertificate X509FindValue="[Api_SslCertHash]" Name="mycert" />
</Certificates>
Now the problem is that we have this file checked in to Git, and since everyone has their own self-signed cert (Not: I don't know if this has to be, maybe we can share certs, by the question remains anyway) the thumbprint is different per developer.
My question is: Is it possible to have the thumbprint in an environment-variable, or get it from another source instead of changing it in the ApplicationManifest. I realise that it could be hard in a cluster environment, but maybe when deploying locally?
I have a similar requirement for ServiceManifest, where I would like to have different port numbers. I know I can override it in Local.1Node.xml but it would be nice to be able to pick it up externally.
I don't see why you cant use a variable like you are doing in your last example, but that doesn't solve your multiple developer problem.
The correct way to handle this is to generate a certificate, check it into source control and make everyone else use the same certificate. In fact, if you set up a secure cluster in production, anyone who wants to be able to view the Explorer will need the same certificate installed on their machine in order to authenticate.

wcf web service identity servicePrincipalName explanation required

I have a web service that uses windows integrated authentication, and it works. But only after much trial and error it only finally worked with my config file endpoint section having an identity as follows:
<identity>
<servicePrincipalName value="host/servername" />
</identity>
Where 'servername' is the name of the IIS server hosting the webservice.
If I missed it out, IIS refused it (did not even get to the end point) with 'authentication error'.
However, when I recently needed to run a program on the same server as the web service this then failed with the same error and it worked only if I completely removed the identity or changed it to 'host/localhost'.
Can somebody explain why this is because I really don't understand what the servicePrincipalName/identity is really doing other than just working.
thanks.
The name of the user you wish the service to use (execute under) are placed as value for ServicePrincipalName.
You can have much simpler reference here.

"Entry has already been added" - Two Separate App Pools

I am creating a test version of an existing production site. A virtual web service application exists inside the site - and the two web configs have the same connection string.
There are no "clear" tags in the production web configs and the site and the web service co-exist merrily on two separate app pools.
On the test site however, every time I browse to the webservice URL I receive the Configuration Error "The entry 'ConnectionString' has already been added."
The test site and corresponding virtual application use their own separate app pools. Any ideas?
Thanks
Jim
Web.config inheritance happens even between different appPools.
If you want to stop this behavior, you should add the attribute enableConfigurationOverride="false" to your appPool in the applicationHost.config file (located in %WINDIR%\System32\inetsrv\Config and %WINDIR%\SysWOW64\inetsrv\config) as in the following example:
<add name="MyAppPool" autoStart="true" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated" enableConfigurationOverride="false">
<processModel identityType="NetworkService" />
</add>
Matteo
I think the problem is related that they are one site inside the other. Like a Website with a Virtual Directory inside.
In this case... the Virtual Directory web.config is "inheriting" the parent web.config
Here you can see details of how to solve this: How to stop inheritance of <configSections>in Web.Config
Other options: https://stackoverflow.com/a/367372/7720
If the problem is in other parts of your web.config (not in the sections) you can just wrap the conflicting part with <location path="." inheritInChildApplications="false">.
Other option could be let the webservice grab the connection from the website.

RavenDB 2 returns 401 when trying to create database

This is a fresh install of Raven #2230, running on IIS8/Win8. When studio starts it offers to create new database, then browser pops up credentials window (401).
Web.config has add key="Raven/AnonymousAccess" value="All"/ set. Also tried add key="Raven/AnonymousUserAccessMode" value="All"/ as per documentation.
Anonymous Authentication on site is enabled, so is Windows Authentication.
Added Raven.Bundles.Authorization.dll to plugins folder (not sure if needed, but didn't make any difference).
Am I missing something ?
RavenDB as of today, is on version 2750 (stable). Upgrade and this issue should be fixed.
The way to do this is to set the AnonymousAccess setting in web.config to Admin:
<add key="Raven/AnonymousAccess" value="Admin"/>
You should change this back to All once you have created your database.

Amazon Elastic Cloud and Silverlight Deployment

We are experimenting with hosting a silverlight application on Amazons EC2.
I can get it to serve up the .xap file, but I'm having some trouble with using the webservices that the silverlight application requires.
Usually I would add a service reference in visual studio and enter the URL for the webservice, something like http://url.com/ServiceName.svc and a proxy would be generated for me.
However with the Amazon Elastic Cloud instance entering the url
http://ec2-174-129-139-48.compute-1.amazonaws.com/AuthService.svc
Gives the error "is not recognised as a known document type"
And if I enter
http://ec2-174-129-139-48.compute-1.amazonaws.com/AuthService.svc?wsdl
Into the internet explorer address bar I get a wsdl description - but it has this part in the config which seems a bit odd
<wsdl:types>
<xsd:schema targetNamespace="http://asp.net/ApplicationServices/v200/Imports">
<xsd:import schemaLocation="http://ip-0af8db15/AuthService.svc?xsd=xsd0" namespace="http://asp.net/ApplicationServices/v200" />
<xsd:import schemaLocation="http://ip-0af8db15/AuthService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
</xsd:schema>
</wsdl:types>
The schemaLocation http://ip-0af8db15/AuthService.svc? doesn't look like the right address to me?
Anyone know if I need to configure something or change something to access WCF webservices on Amazon EC2?
Edit: Should note : Windows Server 2003, IIS 6.0
Edit: Looks like ip-0af8db15 is the machine name
Just in case someone went into the same problem:
on proxy generation try remove the http:// at the beginning of the EC2 Address and then in the Service Config replace the part "ip-0af8db15" with the EC2 Address.
Hope it helped.
I have the same scenario deployed with no issues. Why don't you try using the IP address instead of the dynamic hostname:
http://174.129.139.48/AuthService.svc
Edit:
If an unreachable server name is being put into the VS.Net generated proxy then you can adjust it manually in the automatically generated configuration.svcinfo. Alternatively you can set the URL programatically, this is a better option since it won't get over written if you need to re-generate the proxy.
BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress address = new EndpointAddress("http://174.129.139.48/AuthService.svc");
YourProxy yourProxy = new YourProxy(binding, address);
This thread (particularly the last two posts) helped me to solve this problem.
http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/c7fd51a2-773e-41d4-95a0-244e925597fe/