2010-04-21 63 views
2

我有一个WCF服务设置,我可以使用它作为intendid ...但只能在同一台机器上使用。我期望在多台计算机上工作,并且我对安全性不感兴趣。然而,当我设置(客户端)的安全性=无,我得到一个InvalidOperationException异常:没有安全性的WCF

服务证书并没有提供目标 “http://xxx.xxx.xxx.xxx:8731/Design_Time_Addresses/WcfServiceLibrary/ManagementService/” 。 在 ClientCredentials中指定服务证书。

所以我留下了:

<security mode="Message"> 
    <message clientCredentialType="None" negotiateServiceCredential="false" 
     algorithmSuite="Default" /> 
</security> 

但是这给了我另一个InvalidOperationException异常:

服务证书不 提供目标 'http://xxx.xxx.xxx.xxx:8731/Design_Time_Addresses/WcfServiceLibrary/ManagementService/'。 在 ClientCredentials中指定服务证书。

为什么我要在安全关闭的情况下提供证书?

更新:

服务器应用程序配置:

<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> 

感谢

回答

2

给你一些更多的信息去!

什么是你的服务器端和客户端配置? <system.serviceModel>中的任何内容都是有意义的。你使用什么绑定?

例如:如果您将客户端安全设置为无,您必须在服务器端执行相同的操作 - 这些设置需要匹配!

更新:

OK,用的配置,我可以指出一定的东西出来:

<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?这是一个明智的选择吗?
  • ,如果你不希望任何安全性,您需要使用:

    <security mode="None" /> 
    
  • 你需要同时拥有客户端服务器上的此<bindings>部分,你需要引用从绑定配置你的终点:

    <endpoint 
        address ="" 
        binding="wsDualHttpBinding" 
        bindingConfiguration="WSDualHttpBinding_IManagementService" 
        contract="Server.WcfServiceLibrary.ICheckoutService"> 
        <identity> 
        <dns value="localhost"/> 
        </identity> 
    </endpoint> 
    
+0

更新问题,谢谢! – 2010-04-21 13:25:25

+0

好的,谢谢,是的,有双重http绑定的原因,但atm我不记得为什么!是的,我知道安全=没有。谢谢,如果在10分钟内工作,我会更新! :) – 2010-04-21 13:36:08

+0

目前我可以配置服务引用到我的服务器,但是当我运行我只是得到一个超时:(任何想法为什么? – 2010-04-21 13:51:01