2010-05-27 84 views
4

我們有一個web應用程序,作爲'NETWORK SERVICE'在應用程序池中運行。 Web應用程序連接到另一個Web服務器上的服務(.svc)。另一個Web服務器也具有託管爲「NETWORK SERVICE」的服務。我相信這是默認設置。預期身份upn作爲網絡服務連接到服務,

以下端點在其他任何位置運行時均可正常工作。

<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有關嗎?

Registers Craig。

回答

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="[email protected]" /> 
+0

是的,看看回應 - 這是說它預計UPN。這是UserPrincipalName。將servicePrincipalName更改爲userPrincipalName。你可以嘗試的另一件事是更改server.domain.com到IP地址,看看這是否強制NTLM – Sentinel 2012-03-17 19:50:15