Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
May be this question is asked numerous times before, but since I could not get it my problem solved, hence posting this question.

Well my requirement is simple, I need to run my service under https. I created a normal WCF service which returns the current date and time along with the string passed.

It works pretty well when i view the Service.svc file over a browser under http.

I did some changes to my web.config in order to make the service compatible for https and also created a certificate in my local IIS.

Below is my web.config file

XML
<system.serviceModel>
<services>
  <service name="Service" behaviorConfiguration="ServiceBehavior">
    <!-- Service Endpoints -->
    <endpoint address="" binding="wsHttpBinding" bindingConfiguration="customHttp" contract="IService">

      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="ServiceBehavior">
     <serviceMetadata httpsGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <wsHttpBinding>
    <binding name="customHttp">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
    </binding>
  </wsHttpBinding>
</bindings>


I have created a new wsHttpBinding binding with security mode as transport and attached the binding configuration to the preferred endpoint.

When I try to browse the service.svc file in the browser, it says:

Could not find a base address that matches scheme https for the endpoint with binding WSHttpBinding. Registered base address schemes are [http].

I gave the service URL in the address portion of the endpoint as 'http://[localhost:54110]/samplewcf/Service.svc', then I started getting the error as:

Could not find a base address that matches scheme https for the endpoint with binding MetadataExchangeHttpsBinding. Registered base address schemes are [http].

I tried to change the wsHttpBinding to basicHttpBinding and webHttpBinding, but it doesn't work. I get the above errors.

Since I manually created a certificate using Server Certificates in IIS, i am able to browse localhost over https, but my service does not run under https. I went throught numerous posts in Stack Overflow and many blogs too, but couldn't find the resolution.

Experts kindly assist me. Any pointers would be highly appreciated.

Regards

Anurag
Posted

1 solution

Firstly, you haven't set the endpoint to https, it's written http.

Second, https is reserved for port 433.

So I don't think you can have have https on port 54110. You can't assign a https binding in IIS to a different port.

Get rid of the port number. Create a https binding within IIS. Access using https and no port.
 
Share this answer
 
Comments
Anurag Sinha V 16-Aug-13 0:30am    
@Stephen..I don't think there is any binding for https..basicHttpBinding, wsHttpBinding work for https if we have the security mode as transport.
I have created https binding using 'Edit bindings' in IIS. https is configured to use port 443. Any other thoughts? If you have any sample and stuffs can you post them here...
Appreciate your assistance..

Anurag

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900