【发布时间】:2011-04-01 06:18:30
【问题描述】:
我正在使用我创建的 wcf 服务,当主机和客户端计算机都在同一个域上时,一切正常。 当我将客户端应用程序发布到 DMZ 中的网络服务器时,我收到以下错误:
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="Administrator@bullfrogspas.local" />
</identity>
</endpoint>
</client>
我确定问题是因为它使用的是 Windows 身份验证。有任何想法吗? 谢谢!
【问题讨论】:
-
我不是 100% 确定,所以我不会将此作为答案发布,但 IMO Windows 身份验证只有在客户端和服务器位于同一域或受信任域时才可能。顺便提一句。如果内部网络和 DMZ 都是您企业基础设施的一部分,您为什么选择具有消息安全性的 WsHttpBinding?这是最慢的选择。
-
如果内部网络和 DMZ 都是您企业基础设施的一部分,为什么您选择具有消息安全性的 WsHttpBinding?-- 因为我不知道任何其他方式 :) 我应该使用哪种方式?如前所述,我确信这是导致问题的 Windows 身份验证。那么我需要改用什么?谢谢!
标签: c# wcf wcf-security