简体   繁体   中英

SilverLight HTTPS , basichttpbinding and custombinding

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 !

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM