我們有一個簡單的WCF(使用.NET 4.0)服務,它使用Windows
身份驗證在IIS 7身份驗證功能上啓用。這適用於兩臺服務器上相同的設置和相同的配置,但在其中一臺服務器上出現錯誤Security settings for this service require Windows Authentication but it is not enabled for the IIS application that hosts this service.
我檢查了所有可能的網絡,並嘗試了所有選項,如禁用其他身份驗證機制等。似乎沒有任何工作。任何人都可以指出可能是什麼問題。 兩臺服務器上的相同settigns在第三臺服務器上運行正常,因此存在問題。WCF(.NET 4.0)+ IIS 7 + Windows身份驗證錯誤 - 「服務需要Windows身份驗證,但未啓用IIS應用程序」
<?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>
謝謝[KB文章(http://support.microsoft.com/kb/215383)禁用解決了這個問題。即使KB是針對IIS 6的,它也可以解決IIS 7上的這個問題:D – 2011-03-11 00:23:14