我有一個相當簡單的WCF自託管服務,使用只拒絕工作的WSHttpBinding。如果服務端和客戶端在同一臺機器上運行沒有任何問題,但只要我移動服務至2008年窗口服務器與客戶端WCF WSHttpBinding SOAP安全協商失敗
EXCEPTION
[System.ServiceModel失敗的通信嘗試。 Security.SecurityNegotiationException] {「目標爲'http:// hvw-svr-01/SIT'的SOAP安全協商爲'http:// hvw-svr-01/SIT'失敗,詳情請參閱內部異常。」}
INNER EXCEPTION
[System.ComponentModel.Win32Exception] {「The Security支持提供程序接口(SSPI)協商失敗。服務器可能未運行在身份爲「host/hvw-svr-01」的帳戶中。如果服務器在服務帳戶中運行(例如,網絡服務),請將該帳戶的ServicePrincipalName指定爲該服務器的EndpointAddress中的標識。如果服務器中的用戶帳戶運行,指定帳戶的UserPrincipalName作爲的EndpointAddress服務器的身份。「}
因爲它是一個自託管服務,我想我需要指定的UserPrincipalName,但沒有不管我怎麼努力爲財產,它只是將無法正常工作。
- 域\用戶名
- 域@用戶名
- 主機/本地主機
- 主機/ HVW-SVR-01
- ...等等
不同用戶嘗試它佔藏漢,包括內置的管理員。如果我嘗試BasicHttpBinding而不是WSHttpBinding一切都按預期工作。我在谷歌(和stackoverflow)上閱讀了大量有關這個問題的文章,但我仍然無法確定問題是什麼以及如何指定該標識。
編輯:服務App.Config中
<system.serviceModel>
<services>
<service name="SIT.Communication.Gate">
<host>
<baseAddresses>
<add baseAddress="http://localhost:2323/SIT" />
</baseAddresses>
</host>
<endpoint address="" binding="wsHttpBinding" contract="SIT.Core.IGate">
<identity>
<dns value="localhost"/>
<userPrincipalName value="XZDom\DGrain"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
編輯:客戶端本身基本上是這樣的代碼片段
ChannelFactory<IGate> sitFactory = new ChannelFactory<IGate>(new WSHttpBinding(), new EndpointAddress("http://hvw-svr-01:2323/SIT")); IGate sitProxy = sitFactory.CreateChannel(); bool pong = sitProxy.Ping(); <------ throws exception
您可以發佈用於託管服務的配置嗎? – 2012-02-01 08:19:00
如果您從配置中完全刪除'idenity'部分,它是否工作? – 2012-02-01 09:15:50
Nope不起作用,已經試過了(在stackoverflow上讀取某處) – naacal 2012-02-01 09:18:56