没有安全性的 WCF [英] WCF with No security
问题描述
我有一个 WCF 服务设置,我可以按照预期使用和使用它...但只能在同一台机器上.我希望在多台计算机上运行它,而且我对安全性并不大惊小怪.但是,当我将(客户端)安全性设置为 = none 时,我得到一个 InvalidOperationException:
I've got a WCF service setup which I can consume and use as intendid... but only on the same machine. I'm looking to get this working over multiple computers and I'm not fussed about the security. However when I set (client side) the security to = none, I get a InvalidOperationException:
服务证书不是为目标提供'http://xxx.xxx.xxx.xxx:8731/Design_Time_Addresses/WcfServiceLibrary/ManagementService/'.在中指定服务证书客户凭据.
The service certificate is not provided for target 'http://xxx.xxx.xxx.xxx:8731/Design_Time_Addresses/WcfServiceLibrary/ManagementService/'. Specify a service certificate in ClientCredentials.
所以我只剩下:
<security mode="Message">
<message clientCredentialType="None" negotiateServiceCredential="false"
algorithmSuite="Default" />
</security>
但这给了我另一个 InvalidOperationException:
But this gives me another InvalidOperationException:
服务证书不是为目标提供'http://xxx.xxx.xxx.xxx:8731/Design_Time_Addresses/WcfServiceLibrary/ManagementService/'.在中指定服务证书客户凭据.
The service certificate is not provided for target 'http://xxx.xxx.xxx.xxx:8731/Design_Time_Addresses/WcfServiceLibrary/ManagementService/'. Specify a service certificate in ClientCredentials.
如果关闭安全性,为什么我必须提供证书?
Why would I have to provide a certificate if security was turned off?
更新:
服务器应用配置:
<system.serviceModel>
<services>
<service name="Server.WcfServiceLibrary.ManagementService" behaviorConfiguration="Server.WcfServiceLibrary.ManagementServiceBehavior">
<host>
<baseAddresses>
<add baseAddress = "http://localhost:8731/Design_Time_Addresses/WcfServiceLibrary/ManagementService/" />
</baseAddresses>
</host>
<endpoint address ="" binding="wsDualHttpBinding" contract="Server.WcfServiceLibrary.IManagementService"
bindingConfiguration="WSDualHttpBinding_IManagementService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_IManagementService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:00:10"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="None" />
</binding>
</wsDualHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="Server.WcfServiceLibrary.ManagementServiceBehavior">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
客户端应用配置:
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_IManagementService" 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">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="None" />
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint address="http://xxx:8731/Design_Time_Addresses/WcfServiceLibrary/ManagementService/"
binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IManagementService"
contract="ServiceReference.IManagementService">
<!--name="WSDualHttpBinding_IManagementService">-->
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
谢谢
推荐答案
为您提供更多信息!
你的服务器端和客户端配置是什么??
中的任何内容都值得关注.你使用什么绑定?
What's your server side and client side config?? Anything in <system.serviceModel>
is of interest. What bindings are you using?
例如:如果您将客户端安全性设置为 None,则您必须在服务器端执行相同的操作 - 这些设置需要匹配!
For instance: if you set the client side security to None, you have to do the same on the server side - those settings need to match!
更新:
好的,通过配置,我可以指出某些事情:
OK, with the config, I can point certain things out:
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_IManagementService" ......>
<readerQuotas .... />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="Message">
<message clientCredentialType="Windows"
negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
问题:
- 你真的需要 wsDualHttpBinding 吗?这是明智的选择吗?
如果您不想要任何安全性,则需要使用:
- do you really need wsDualHttpBinding? Is that an informed choice?
if you don't want any security, you need to use:
<security mode="None" />
您需要在客户端和服务器上都有这个
you need to have this <bindings>
section on both client AND server, and you need to reference that binding configuration from your endpoints:
<endpoint
address =""
binding="wsDualHttpBinding"
bindingConfiguration="WSDualHttpBinding_IManagementService"
contract="Server.WcfServiceLibrary.ICheckoutService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
这篇关于没有安全性的 WCF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!