2011-03-10 78 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