WCF with No security

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:

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.

So I'm left with:

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

But this gives me another InvalidOperationException:

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?

UPDATED:

Server app config:

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

Client app config:

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

Thanks


Gives you some more info to go on!!

What's your server side and client side config?? Anything in <system.serviceModel> is of interest. What bindings are you using?

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!

Update:

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>

Questions:

  • 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>
    
  • 链接地址: http://www.djcxy.com/p/21606.html

    上一篇: 许多服务器,一个客户端

    下一篇: WCF没有安全性