簡體   English   中英

WCF(.NET 4.0)+ IIS 7 + Windows身份驗證錯誤 - “服務需要Windows身份驗證,但它未啟用IIS應用程序”

[英]WCF (.NET 4.0) + IIS 7 + Windows Authentication Error - “service require Windows Authentication but it is not enabled for the IIS application ”

我們有一個簡單的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在第三台服務器上完全正常運行它有問題。

<?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>

這個帖子中的任何解決方案都有效嗎?

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

在這篇博文中 ,它提到了這篇知識庫文章

如果返回此錯誤並且在IIS中啟用了Windows身份驗證,則表示支持的網絡身份驗證方案存在安裝Web服務的網站的問題。 最可能的原因是它僅配置為NTLM。 我們想要指定NTLM和Negotiate。

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

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

可能有一台機器從父配置文件繼承此設置,但沒有在拋出錯誤的機器上繼承此設置。

您還可以驗證匿名身份驗證是否已禁用,如下圖所示

在此輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM