Paul Dema
Paul Dema

Reputation: 43

Problem with configuring HTTPS on my WCF service

I am trying to add transport security layer to my WCF service. But after following all the instructions i still get error "Could not find a base address that matches scheme https for the endpoint with binding BasicHttpBinding. Registered base address schemes are [http]."

Already did all needed configurations in IIS Manager and add need code in web.config but i still have a feeling i am missing something

web.config:

   <system.serviceModel>   
          <services>
              <service name="MyNameSpace.MyService" behaviorConfiguration="secureBehavior">                     
                <endpoint address="" binding="basicHttpBinding" bindingConfiguration="secureHttpBinding" contract="MyNameSpace.IMyService" />
                <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
              </service>          
            </services>

        <bindings>
          <basicHttpBinding>
            <binding name="secureHttpBinding">
              <security mode="Transport">
                <transport clientCredentialType="None" />
              </security>
            </binding>
          </basicHttpBinding>      
        </bindings>

        <behaviors>
          <serviceBehaviors>
            <behavior name="secureBehavior">
              <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
          </serviceBehaviors>
        </behaviors>    

        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
      </system.serviceModel>

Upvotes: 1

Views: 344

Answers (1)

Abraham Qian
Abraham Qian

Reputation: 7532

There is no problem with your present configuration, configure an https endpoint and it uses Transport security mode. One more thing we need to do is configuring an https binding address in IIS binding module. Like below.
enter image description here
It locates in the IIS site binding module.
enter image description here
Then we could use the above https service address to access it.
https://IP:4431/Service1.svc (service base address)
Feel free to let me know if the problem still exists.

Upvotes: 1

Related Questions