我使用的是我創建的一個wcf服務,當宿主機和客戶機在同一個域上時,一切正常。 當我發佈的客戶端應用程序的網絡服務器在DMZ中我收到以下錯誤:WCF安全支持提供程序接口(SSPI)協商失敗
SOAP security negotiation with 'http://10.0.0.14:3790/Bullfrog/QBService/QBService' for
target 'http://10.0.0.14:3790/Bullfrog/QBService/QBService' failed. See inner exception
for more details.The Security Support Provider Interface (SSPI) negotiation failed.
這裏是我的服務主要在哪裏設置服務
Uri baseAddress = new Uri("Http://10.0.0.14:3790/Bullfrog/QBService");
ServiceHost selfHost = new ServiceHost(typeof(QBService), baseAddress);
try
{
selfHost.AddServiceEndpoint(
typeof(IQBService),
new WSHttpBinding(),
"QBService");
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
selfHost.Description.Behaviors.Add(smb);
selfHost.Open();
Console.WriteLine("The service is ready");
}
catch (CommunicationException ce)
{
//log.Error(ce.Message, ce);
Console.WriteLine(ce.Message, ce);
selfHost.Abort();
}
這裏是配置我的客戶端部分
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IQBService" 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"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://10.0.0.14:3790/Bullfrog/QBService/QBService"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IQBService"
contract="IQBService" name="WSHttpBinding_IQBService">
<identity>
<userPrincipalName value="[email protected]bullfrogspas.local" />
</identity>
</endpoint>
</client>
我相信問題是因爲它使用Windows身份驗證。有任何想法嗎? 謝謝!
我不是100%確定的,所以我不會發布這個答案,但只有當客戶端和服務器都在同一個域或受信任的域中時,IMO Windows身份驗證纔是可能的。順便說一句。如果內部網絡和DMZ都是你的企業基礎設施的一部分,你爲什麼選擇WsHttpBinding和消息安全?這是最慢的選擇。 – 2010-08-19 20:56:38
如果內部網絡和DMZ都是你的企業基礎設施的一部分你爲什麼選擇WsHttpBinding和消息安全? - 因爲我不知道其他方式:)我應該使用哪一個?如上所述,我相信它是造成問題的Windows身份驗證。那麼我需要使用什麼呢? 謝謝! – twal 2010-08-19 21:02:06