开发者

WCF (.NET 4.0) + IIS 7 + Windows Authentication Error - "service require Windows Authentication but it is not enabled for the IIS application "

开发者 https://www.devze.com 2023-02-16 15:30 出处:网络
We have a simple WCF (on .NET 4.0) Service which uses Windows authentication and same is enabled on the IIS 7 Authentication feature. This works with same settings and same configuration on two server

We have a simple WCF (on .NET 4.0) Service which uses Windows authentication and same is enabled on the IIS 7 Authentication feature. This works with same settings and same configuration on two servers, but on one of the server comes back with error Security settings for this service require Windows Authentication but it is not enabled for the IIS application that hosts this service. I checked everything possible on web, and tried all the options like disabling other Authentication mechanisms etc. Nothing seems to be working. Could anyone point what can be the issue. Again identical settigns on two servers is working perfectly on third server it has the issue.

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="ABCDbConnection" value="Data Source=xxx; Initial Catalog=sss;Integrated Security=True"/>
    <add key="MetadataDbConnection" value="Data Source=xxx; Initial Catalog=sss;Integrated Security=True"/>
    <add key="UsageEnabled" value="True"/>
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <protocolMapping>
      <add scheme="http" binding="basicHttpBinding" bindingConfiguration="WindowsBasicHttpBinding"/>
    </protocolMapping>
    <behaviors>
<serviceBehaviors>
    <behavior>
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <dataContractSerializer maxItemsInObjectGraph="6553600"/>
    </behavior>
</serviceBehaviors>
</behaviors>
<bindings>开发者_开发问答
  <basicHttpBinding>
    <binding name="WindowsBasicHttpBinding">
      <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows"/>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>


Did any of the solutions in this thread work?

http://social.msdn.microsoft.com/Forums/en/wcf/thread/021babc6-2009-4ed9-81f4-ac48cc300c94

From this blog post, it mentioned this KB article.

If this error is returned and Windows Authentication has been enabled in IIS, it means there is an issue with the supported network authentication schemes for the website that the web service is installed under. The most likely cause is that it is configured for NTLM only. We want to specify NTLM and Negotiate.


Have you tried enabling Windows Authentication through the web.config using

<system.web>
       ....
    <authentication mode="Windows" /> 
       .....
</system.web>

There could be the possibility that one machine is inheriting this setting from a parent configuration file but not on the one throwing the error is not.

You can also verify that Anonymous Authentication is disabled like in the image below

WCF (.NET 4.0) + IIS 7 + Windows Authentication Error - "service require Windows Authentication but it is not enabled for the IIS application "

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号