0
votes

I'm switching my SL5 application from http to https and I ran into a problem with my WCF services.

Those using a custombinding are working fine but not those using basichttpbinding.

Why ?

ServiceReferences.ClientConfig :

<configuration>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="MyBindingName" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <security mode="Transport" />
        </binding>
      </basicHttpBinding>
      <customBinding>
        <binding name="CustomBinding_WebService">
          <binaryMessageEncoding />
          <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
        </binding>
      </customBinding>
    </bindings>
<client>
       <endpoint address="../MyBasicService.svc"
        binding="customBinding" bindingConfiguration="MyBindingName"
        contract="ServiceContract"
        name="MyBindingName" />
      <endpoint address="../MyService.svc"
        binding="customBinding" bindingConfiguration="CustomBinding_WebService"
        contract="ServiceContract"
        name="CustomBinding_WebService" />
    </client>
  </system.serviceModel>
</configuration>

Web.config for service using custom binding :

<binding name="customBinding0">
          <binaryMessageEncoding />
          <httpsTransport />
        </binding>

<service name="WorkingCustomService">
       <endpoint address="" binding="customBinding" bindingConfiguration="customBinding0" contract="WebService"/>
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
      </service>

Web.config for service using basichttpbinding

<binding name="basicHttpBinding" maxBufferSize="2147483647"
          maxReceivedMessageSize="2147483647">
          <security mode="Transport"/>
        </binding>

       <service name="ReportService" behaviorConfiguration="ReportServiceBehavior" >
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ReportingService" contract="ReportServiceContract" />    
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" /> 
      </service>

<behavior name="ReportServiceBehavior">
          <serviceMetadata httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>

Thanks !

1

1 Answers

0
votes

Alright, found the solution thanks to : configuring WCF with <services> tag

The name of my service was not respecting this rule :

Your service name must be the fully qualified name (YourNamespace.YourClassName) of your service class - the class that implements your service contract

This apparently was not a problem in https but it was one in https.

Edit : In my case, the file .svc was moved during development but the name of the service in the web.config was not updated to reflect the change, which caused the problem.