预期身份upn连接到服务作为网络服务,

时间:2010-05-27 12:06:09

标签: wcf authentication spn upn

我们有一个Web应用程序,在应用程序池中作为“NETWORK SERVICE”运行。 Web应用程序连接到另一个Web服务器上的服务(.svc)。另一个Web服务器也将服务托管为“网络服务”。我相信这是默认的。

以下端点在其他地方运行时效果很好。

<endpoint address="http://server123/UnitTrustService/UnitTrustService.svc"
  binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_UnitTrustService"
  contract="UnitTrustServiceReference.UnitTrustService" name="WSHttpBinding_UnitTrustService">
 <identity>
  <servicePrincipalName value="server123" />
 </identity>
</endpoint>

不幸的是,从网站执行时,我们收到以下错误。

        System.ServiceModel.Security.MessageSecurityException: 
    The identity check failed for the outgoing message. 
    The expected identity is 'identity(http://schemas.xmlsoap.org/ws/2005/05/identity/right/possessproperty: http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn)' 
for the 'http://server123/UnitTrustService/UnitTrustService.svc' target endpoint. 
Server stack trace: at System.ServiceModel.Security.IdentityVerifier.EnsureIdentity(EndpointAddress serviceReference, AuthorizationContext authorizationContext, String errorString)...

有什么想法吗? 我已尝试在Web服务器计算机上将其作为本地系统运行,配置完全相同,并且运行正常。

它与IIS有关吗?

此致 克雷格。

1 个答案:

答案 0 :(得分:4)

这可能表示客户端 web.config存在问题。仔细检查客户端的<identity>。例如,如果服务期望身份为userPrincipalName而不是servicePrincipalName,则客户端的web.config中的以下示例代码段可能会导致此异常。这是一个容易区分的错过,以前让我感动。

<system.serviceModel>
    <client>
      <endpoint address="http://server.domain.com/Services/DoSomething.svc" behaviorConfiguration="EndpointBehavior" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IDoSomething" contract="Mycontract" name="WSHttpBinding_IDoSomething_Custom_AddSomething">
        <identity>
          <servicePrincipalName value="user@domain.com" />
相关问题