Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable HTTPS traffic for WCF Service. Issue with changing traffic http to https

The issue is: I tried to change WCF service traffic from HTTP to HTTPS. But I am not able to access this service, I am getting 404 error. I saw some blogs saying that we need to add the custom binding. but I am not getting.

Please, help me with this. Below is my web config for default HTTP binding.

I want this to change to HTTPS.

<system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior>
          <webHttp helpEnabled="True" />
        </behavior>
      </endpointBehaviors>
    </behaviors>

    <protocolMapping>
      <add binding="webHttpBinding" scheme="http" />

    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <directoryBrowse enabled="true" />
    <httpProtocol>
    </httpProtocol>
  </system.webServer>
like image 592
Sharad Avatar asked Aug 16 '26 01:08

Sharad


1 Answers

I have added the following code below the <behaviors> tag and working like a champ.

<bindings>
        <webHttpBinding>
            <binding>
                <security mode="Transport" />
                </binding>
        </webHttpBinding>
    </bindings>
like image 104
Sharad Avatar answered Aug 18 '26 15:08

Sharad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!