IIS中的WCF服务的安全支持提供程序接口(SSPI)协商失败

时间:2016-04-27 08:45:56

标签: wcf iis wshttpbinding

我在部署WCF服务时遇到问题。在开发机器上一切正常。但是,当我试图通过http端口80在IIS服务器上托管它时。我遇到了安全问题。

只是复制它会产生错误The request for security token could not be satisfied because authentication failed,我注意到我的dns身份是:

      <identity>
        <dns value="localhost"/>
      </identity>

所以我把它改为:

      <identity>
        <dns value="ServerName"/>
      </identity>

但是,我现在正在获得The Security Support Provider Interface (SSPI) negotiation failed(所以它似乎已经超越了DNS身份,问题)。这是我的web.config文件中的服务:

  <system.serviceModel>
    <services>
      <service name="WCFDataInterface.Service">
        <!-- Service Endpoints -->
        <endpoint address="" binding="wsHttpBinding" contract="WCFDataInterface.IService">
          <identity>
            <dns value="ServerName"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="wsHttpBinding" scheme="http"/>
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>

有人可以帮忙设置吗?我在互联网上找到的所有资源似乎都增加了混乱。我找不到任何方法来解决托管wsHttpBinding服务的身份验证问题。

1 个答案:

答案 0 :(得分:0)

在尝试了许多解决方案之后,我认为至少通过将安全模式设置为无,我可以在此期间完成工作:

<bindings>
  <wsHttpBinding>      
    <binding name="myBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">         
      <readerQuotas maxDepth="200" maxStringContentLength="8388608" maxArrayLength="16384" maxBytesPerRead="2147483647" maxNameTableCharCount="16384" />
      <security mode="None" />
      <reliableSession enabled="true" />
    </binding>
  </wsHttpBinding>
</bindings>