用于SOAP调用的UPN标识在集群服务中切换

时间:2013-07-12 17:11:17

标签: wcf soap windows-authentication

我进行了一次调用,其中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''http://host-name:PORT/EndpointName'的SOAP安全协商失败。有关详细信息,请参阅内部异常---&GT; System.ComponentModel.Win32Exception:安全支持提供程序接口(SSPI)身份验证失败。服务器可能未在身份'host / host-name'的帐户中运行。如果服务器正在服务帐户(例如,网络服务)中运行,请将该帐户的ServicePrincipalName指定为服务器的EndpointAddress中的标识。如果服务器在用户帐户中运行,请将该帐户的UserPrincipalName指定为服务器的EndpointAddress中的标识。

请注意:用于SOAP调用的标识是主机名(如上所述),而不是它应该的DOMAINNAME\serviceAccount,就像我在调试器中运行时一样。服务器上可能会关闭哪些设置来导致此问题?

我检查了服务正在发布的wsdlwsdl: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>

0 个答案:

没有答案