Monday, May 9, 2016

WCF Service failing in IIS Express

I am working on an ASP.NET application using Visual Studio 2015. I typically debug using IIS Express. Today I ran into the following error when the app was trying to asynchronously call the WCF Web Services:

Exception Details: System.NotSupportedException: The authentication schemes configured on the host ('IntegratedWindowsAuthentication, Basic') do not allow those configured on the binding 'WebHttpBinding' ('Anonymous').  Please ensure that the SecurityMode is set to Transport or TransportCredentialOnly.  Additionally, this may be resolved by changing the authentication schemes for this application through the IIS management tool, through the ServiceHost.Authentication.AuthenticationSchemes property, in the application configuration file at the <serviceAuthenticationManager> element, by updating the ClientCredentialType property on the binding, or by adjusting the AuthenticationScheme property on the HttpTransportBindingElement.

I tried several things in both .\Web.config and .\.vs\config\applicationhost.config, but those tweaks did not fix it. I finally found this answer from Borek.

The answer from @Borek was helpful to me, except that I had to enable <IISExpressAnonymousAuthentication> in my .csproj.userfile instead of the .csproj file. I believe that is because the "Apply server settings to all users (store in project file)" option is unchecked in our application (thus the reason the setting was in my.csproj.user file).

No comments:

Post a Comment