【发布时间】:2011-07-14 12:11:12
【问题描述】:
我正在开发具有双工通信的 WCF 服务,但在通过我的开发机器上的本地主机以外的任何地方工作时遇到问题。
无论我做什么,都会出现以下错误:
{"安全支持提供程序接口 (SSPI) 身份验证失败。 服务器可能不在具有身份的帐户中运行 '主机/crpnyciis20e'。如果服务器在服务帐户中运行 (例如网络服务),指定帐户的 ServicePrincipalName 作为 EndpointAddress 中的标识 服务器。如果服务器在用户帐户中运行,请指定 帐户的 UserPrincipalName 作为 EndpointAddress 中的身份 服务器。”}
我的服务Web.config如下:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<protocolMapping>
<add scheme="http" binding="wsDualHttpBinding"/>
</protocolMapping>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
还有我客户的 App.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_IMessagingService" 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">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="Message">
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint
binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IMessagingService"
contract="CTMessagingServiceReference.IMessagingService" name="WSDualHttpBinding_IMessagingService">
<identity>
<userPrincipalName value="nbdfp2k" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
有什么想法可以解决这个问题吗?如果有任何其他有助于诊断的代码,请告诉我……据我所知,其余部分与连接配置无关。
【问题讨论】:
-
您的计算机是否在活动目录域中?用户是否从该域连接到您的服务?
-
是的,它在广告上。 Web 服务当前在服务用户帐户下的 DEV IIS 框上运行。
-
并且是
nbdfp2k服务域帐户的名称? -
不,那是我的帐户...但我也尝试过那里的服务帐户...而且那是给客户的,而不是服务。
-
客户端端点中指定的身份必须是服务之一,因为它是客户端应该信任的一个。如果在运行时服务在任何其他位置运行,它将完全失败并出现您遇到的异常。