Answered Allowing Purely Anonymous WCF Requests

  • Thursday, July 26, 2012 5:21 AM
     
     
    How do I configure IIS so that my WCF Service allows purely anonymous requests?  I get the following error message: The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'.

All Replies

  • Thursday, July 26, 2012 11:11 AM
     
      Has Code

    If you want a purely anonymous request then turn security off. If you are using wsHttpBinding, the default will be Message Security with Windows Authentication.

    Create a binding element such as:

    <bindings>
      <wsHttpBinding>
        <binding name="wsHttp">
          <security mode="None">
        </binding>
      </wsHttpBinding>
    </bindings>

    Set the binding configuration on your endpoint to point to wsHttp. No authentication will take place.
  • Saturday, July 28, 2012 2:57 AM
     
     

    Hi, Dragan!

    Based on your response and given my understanding, I modified the WCF service web.config file as follows, but I still get the same error.  Did I do something wrong (see below)?  Please advise.

    Thank-you!

    <configuration>
        :
        :
      <system.serviceModel>
        <diagnostics wmiProviderEnabled="true">
          <messageLogging logMalformedMessages="true" logMessagesAtServiceLevel="true"
            logMessagesAtTransportLevel="true" />
        </diagnostics>
        <bindings>
          <wsHttpBinding>
            <binding name="wsHttp">
              <security mode="None"/>
            </binding>
          </wsHttpBinding>
        </bindings>
        <services>
          <service behaviorConfiguration="WebUploadService.WebUploadServiceBehavior"
            name="Citi.Services.WebUploadService">
            <endpoint address="" binding="wsHttp" contract="Citi.Services.IWebUploadService">
              <identity>
                <dns value="MyComputerName.MyDomain.net" />
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="WebUploadService.WebUploadServiceBehavior">
              <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
              <serviceMetadata httpGetEnabled="true"/>
              <!-- 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="true"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>
        :
        :
    </configuration>

  • Sunday, July 29, 2012 4:26 PM
     
     Answered Has Code

    Hi, sorry for a late reply. Change your enpoint to the following:

    <endpoint address="" binding="wsHttpBinding" contract="Citi.Services.IWebUploadService"
    bindingConfiguration="wsHttp">
     


    Also, ensure that windows authentication is switched off in IIS
    and ensure that Anonymous access is on in IIS