2011-03-10 79 views
3

我們有一個簡單的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> 

回答

2

此線程中的任何解決方案是否有效?

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

從這個blog post,它提到了這一點KB article

如果返回該錯誤和Windows 驗證已在 IIS被啓用,這意味着有與 支持的網絡身份驗證 方案對於網絡 服務是安裝在該網站的問題。最可能的原因是 僅針對NTLM配置爲 。我們要指定NTLM 和Negotiate。

+0

謝謝[KB文章(http://support.microsoft.com/kb/215383)禁用解決了這個問題。即使KB是針對IIS 6的,它也可以解決IIS 7上的這個問題:D – 2011-03-11 00:23:14

2

您是否嘗試過通過使用web.config中啓用Windows身份驗證

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

有可能是一體機繼承了父配置文件此設置但不是在一個引發錯誤的可能性不是。

您也可以驗證匿名身份驗證是像下面的圖片在你的答案提供

enter image description here

+0

我已經在問題中提到了這個問題。 – 2011-03-10 21:39:37