Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
Platform:

Windows 7 Enterprise SP 1
.NET Framework 4 w/ WCF Services…
IIS 7.5 (Virt dir hosting WCF service configured for Windows Authentication only. Anonymous disabled)
Silverlight V4 Client

Error:
The error I get when trying to access a WCF service configured to use Windows Authentication (either by launching the service/host web project from within visual studio, or trying to access the service via IE (http://localhost/SecurityService.svc) is:

Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NotSupportedException: Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service.

The web config for the WCF Service is :
XML
<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
    <authentication mode="Windows"/>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="false"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <basicHttpBinding>
        <binding name="AppHttpBinding" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" />
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows"/>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service name="Volpe.Services.SAS.Internal.Host.SecurityService">
        <endpoint name="AppHttpEndpoint" address=""
                  binding="basicHttpBinding" bindingConfiguration="AppHttpBinding"
                  contract="Volpe.Services.SAS.Internal.Contracts.Security.ISecurityService" />
      </service>
      <service name="Volpe.Services.SAS.Internal.Host.NotificationService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="AppHttpBinding"
            contract="Volpe.Services.SAS.Internal.Contracts.Notifications.INotificationService"/>
      </service>
    </services>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>

I of course Googled this error multiple times, and saw various technical articles addressing how to get rid of the error. Most attributed it to having a MEX endpoint defined. As you can see in the web.config above, there is no such endpoint defined. It seems like there’s something specific in our solution framework that is causing the WCF runtime to think that it requires Anonymous access to the site. I tried debugging it by trying a multitude of potential solutions. I even downloaded the .NET framework code and stepped through it, but I still get the error.

Any help would be greatly appreciated.

Thanks,
Tom
Posted
Updated 10-May-11 7:15am
v2
Comments
Mark Salsbery 17-Nov-11 11:15am    
Does your client configuration match the service configuration? Anything in here that may help (if you haven't been through all these already)? How to: Use basicHttpBinding with Windows Authentication and TransportCredentialOnly in WCF[^]

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900