繁体   English   中英

WCF安全支持提供程序接口(SSPI)协商失败

[英]WCF The Security Support Provider Interface (SSPI) negotiation failed

我正在使用我创建的wcf服务,当托管计算机和客户端计算机都在同一个域上时,一切正常。 当我将客户端应用程序发布到DMZ中的Web服务器时,我收到以下错误:

SOAP security negotiation with 'http://10.0.0.14:3790/Bullfrog/QBService/QBService' for   
target 'http://10.0.0.14:3790/Bullfrog/QBService/QBService' failed. See inner exception  
for more details.The Security Support Provider Interface (SSPI) negotiation failed.

这是我设置服务的服务主要部分

      Uri baseAddress = new Uri("Http://10.0.0.14:3790/Bullfrog/QBService");
      ServiceHost selfHost = new ServiceHost(typeof(QBService), baseAddress);

            try
            {
                selfHost.AddServiceEndpoint(
                    typeof(IQBService),
                    new WSHttpBinding(),
                    "QBService");

                ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
                smb.HttpGetEnabled = true;
                selfHost.Description.Behaviors.Add(smb);
                selfHost.Open();

                Console.WriteLine("The service is ready");


            }
            catch (CommunicationException ce)
            {
                //log.Error(ce.Message, ce);
                Console.WriteLine(ce.Message, ce);
                selfHost.Abort();
            }

这是我客户端的配置部分

  <system.serviceModel>
<bindings>
  <wsHttpBinding>
    <binding name="WSHttpBinding_IQBService" closeTimeout="00:01:00"
        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
        bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
        maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
        messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
        allowCookies="false">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
          maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <reliableSession ordered="true" inactivityTimeout="00:10:00"
          enabled="false" />
      <security mode="Message">
        <transport clientCredentialType="Windows" proxyCredentialType="None"
            realm="" />
        <message clientCredentialType="Windows" negotiateServiceCredential="true"
            algorithmSuite="Default" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>
<client>
  <endpoint address="http://10.0.0.14:3790/Bullfrog/QBService/QBService"
      binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IQBService"
      contract="IQBService" name="WSHttpBinding_IQBService">
    <identity>
      <userPrincipalName value="Administrator@bullfrogspas.local" />
    </identity>
  </endpoint>
</client>

我确定问题是因为它正在使用Windows身份验证。 有任何想法吗? 谢谢!

我不认为这会起作用,我没有环境来快速测试它。 SSPI使用NTLM或Kerberos(如果未使用服务凭证协商,则必须使用)来验证客户端和服务上的客户端上的服务。 NTLM和Kerberos都期望相同的域或可信域。

如果要使用邮件安全性,可以更改配置以使用证书或用户名+密码(服务仍需要证书)。 您可以在活动目录或任何其他凭据存储中验证用户名和密码。

请记住,消息安全性是最慢的。 通过传输安全性(HTTPS)可以实现更好的性能 - 它可以通过网络设备加速。 如果使用HTTPS,则可以将其与基本身份验证结合使用,并从代码中提供客户端凭据,以便在内部区域中调用服务,并使用域凭据进行身份验证。 服务将通过其用于HTTPS的证书进行身份验证。 HTTPS还允许客户端将证书发送到服务的mutal证书身份验证 - 如果正确配置的客户端证书可以映射到域帐户。 这两种方法类似于消息安全性中提到的方法,但不使用SOAP头中的发送凭证,而是使用HTTP头。

我认为你应该在你的web.config中评论以下代码

<identity>
      <userPrincipalName value="Administrator@bullfrogspas.local" />
</identity>

因为它解决了我的问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM