3

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>
9
  • Just a question, but are you hosting this service in IIS?
    – Stefan
    Sep 3, 2018 at 11:17
  • Yes hosting in Azure.
    – Sharad
    Sep 3, 2018 at 11:17
  • Not sure, but I think you can just configure azure to host the service on 443 SSL port. You will need a certificate though.
    – Stefan
    Sep 3, 2018 at 11:18
  • Without Certificate, I can able to change http traffic to https for Web application UI part. In case of WCF only I am not able to. For WCF we must need SSL certificate?
    – Sharad
    Sep 3, 2018 at 11:20
  • I was under the impression a SSL/TSL certificate is also required for any other Web Application (if you are using https).
    – Stefan
    Sep 3, 2018 at 11:26

1 Answer 1

1

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

<bindings>
        <webHttpBinding>
            <binding>
                <security mode="Transport" />
                </binding>
        </webHttpBinding>
    </bindings>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.