Note that there are some explanatory texts on larger screens.

plurals
  1. POWindows Authentication for WCF service with Silverlight 5, IIS 7.5
    text
    copied!<p>I have a Silverlight 5 Prism application with a (regular) WCF service in an ASP.net project. I'm using IIS 7.5 to host it on the localhost. I followed all the steps in </p> <p><a href="http://msdn.microsoft.com/en-us/library/dd744835%28v=vs.95%29.aspx" rel="nofollow noreferrer">How to: Use Windows Authentication to Secure a Service for Silverlight Applications</a></p> <p><a href="http://msdn.microsoft.com/en-us/library/dd560702%28v=vs.95%29.aspx" rel="nofollow noreferrer">How to: Host a Secure Service in ASP.NET for Silverlight Applications</a></p> <p>but I can't get windows authentication to work. Whenever I turn off anonymous authentication in IIS, my application throws an <code>The remote server returned an error: NotFound.</code> exception because it doesn't find the WCF service.</p> <p>When I try to update the service reference in Visual Studio I get the error <code>Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service.</code></p> <p>When I turn on Anonymous Authentication the service works, but I don't get the windows user credentials. My browser (IE 8) is set to use integrated windows authentication and automatically logon in the local intranet. </p> <p>What am I doing wrong?</p> <p>Here is my IIS 7.5 configuration. The Application pool is running in Integrated mode:</p> <p><img src="https://i.stack.imgur.com/tXFBG.png" alt="IIS configuration"></p> <p>web.config:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;configuration&gt; &lt;system.web&gt; &lt;compilation debug="true" /&gt; &lt;authentication mode="Windows" /&gt; &lt;/system.web&gt; &lt;system.serviceModel&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name=""&gt; &lt;serviceMetadata httpGetEnabled="true" /&gt; &lt;serviceDebug includeExceptionDetailInFaults="false" /&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true" /&gt; &lt;/system.serviceModel&gt; &lt;/configuration&gt; </code></pre> <p>ServiceReferences.ClientConfig:</p> <pre><code>&lt;configuration&gt; &lt;system.serviceModel&gt; &lt;bindings&gt; &lt;basicHttpBinding&gt; &lt;binding name="BasicHttpBinding_ISecurityService" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"&gt; &lt;security mode="TransportCredentialOnly" /&gt; &lt;/binding&gt; &lt;/basicHttpBinding&gt; &lt;/bindings&gt; &lt;client&gt; &lt;endpoint address="http://localhost:85/SecurityService/SecurityService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISecurityService" contract="SecurityServiceReference.ISecurityService" name="BasicHttpBinding_ISecurityService" /&gt; &lt;/client&gt; &lt;/system.serviceModel&gt; &lt;/configuration&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload