I have a WCF service being hosted in a Windows Service and is being called from a Windows Forms application. I'm using Windows Authentication and impersonation. Impersonation is working; however, when I attempt to access SQL server using Integrated Security I get “Login failed for user ‘’. “. I also get the same results when hosting the service inside a console application. If I use SQL security everything works as it should.
Here is my config file for the service.
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IService">
<security mode="Message">
<transport clientCredentialType="Windows"
proxyCredentialType="None" realm="" />
<message clientCredentialType="Windows"
negotiateServiceCredential="true"
algorithmSuite="Default"
establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceAuthorization impersonateCallerForAllOperations="true" />
</behavior>
</serviceBehaviors>
<serviceBehaviors>
<behavior name="DefaultBehavior">
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="ServiceBehavior" name="AfsNetService">
<endpoint address="" binding="wsHttpBinding" contract="IAfsNetService">
<identity>
<userPrincipalName value="[email protected]" />
<servicePrincipalName value="localhost" />
<!--<dns value="" />-->
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
Any help with this is appreciated.