1

我进行了一个调用,其中 WCF 服务客户端的构造如下:

var endpointIdentity = EndpointIdentity.CreateUpnIdentity("DOMAINNAME\serviceAccountName@DOMAINNAME");
var endpointAddress = new EndpointAddress(theServiceUri, endpointIdentity);
var serviceClient = new ServiceReference.ServiceClient("WSHttpBinding_Service", endpointAddress);

绑定看起来像这样:

<wsHttpBinding>
  <binding name="WSHttpBinding_Service"
           closeTimeout="02:00:00"
           openTimeout="02:00:00"
           receiveTimeout="02:00:00"
           sendTimeout="02:00:00"
           bypassProxyOnLocal="false"
           transactionFlow="false"
           hostNameComparisonMode="StrongWildcard"
           maxBufferPoolSize="2147483647"
           maxReceivedMessageSize="2147483647"
           messageEncoding="Text"
           textEncoding="utf-8"
           useDefaultWebProxy="true"
           allowCookies="false">
    <readerQuotas maxDepth="2147483647"
                  maxStringContentLength="2147483647"
                  maxArrayLength="2147483647"
                  maxBytesPerRead="2147483647"
                  maxNameTableCharCount="2147483647" />
    <reliableSession ordered="true"
                     inactivityTimeout="02:00:00"
                     enabled="false" />
    <security mode="Message">
      <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
      <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" />
    </security>
  </binding>
</wsHttpBinding>

此代码在集群服务中运行。当serviceClient调用它的一种方法时,我收到了这个错误:

'http://host-name:PORT/EndpointName'与目标的SOAP 安全协商'http://host-name:PORT/EndpointName'失败。有关更多详细信息,请参阅内部异常。---> System.ComponentModel.Win32Exception:安全支持提供程序接口 (SSPI) 身份验证失败。服务器可能未在身份为'host/host-name'的帐户中运行。如果服务器在服务帐户(例如网络服务)中运行,请将帐户的 ServicePrincipalName 指定为服务器的 EndpointAddress 中的标识。如果服务器在用户帐户中运行,请将帐户的 UserPrincipalName 指定为服务器的 EndpointAddress 中的标识。

请注意:用于 SOAP 调用的身份是主机名(上面强调过),DOMAINNAME\serviceAccount不像它应该的那样,就像我通过调试器运行时那样。服务器上的哪些设置可能会导致此问题?

我检查了wsdl服务正在发布,该wsdl:service块看起来像我期望的那样:

<wsdl:service name="Service">
    <wsdl:port name="WSHttpBinding_Service" binding="tns:WSHttpBinding_Service">
        <soap12:address location="http://localhost:PORT/EndpointName"/>
        <wsa10:EndpointReference>
            <wsa10:Address>http://localhost:PORT/EndpointName</wsa10:Address>
            <Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
                <Upn>serviceAccount@DOMAINNAME</Upn>
            </Identity>
        </wsa10:EndpointReference>
    </wsdl:port>
</wsdl:service>
4

0 回答 0