Expose WCF service through HTTPS for SOAP and REST
Introduction
In this article we come to know, how to expose REST and SOAP WCF service over HTTPS. We also
come to know different SSL related settings in IIS.
Objective
To learn how to expose
website or WCF Service over https and also how to use secure socket layer.
ExplanationTo expose service over
HTTPS you have do the following:-
1. Web.config
file changes
2. IIS
changes
Web.config file changes
1. In serviceMetaData change httpGetEnabled=
true to httpsGetEnabled= true.
2. Set
mexHttpBinding as mexHttpsBinding
<endpoint
address="mex" binding="mexHttpsBinding"
contract="IMetadataExchange" />
3. Set Binding for REST and
SOAP
<bindings>
<webHttpBinding>
<binding
name="SecureWebBinding">
<security mode="Transport"></security>
</binding>
</webHttpBinding>
<basicHttpBinding>
<binding
name="SecureBasicBinding">
<security mode="Transport"></security>
</binding>
</basicHttpBinding>
</bindings>
4. Set bindingConfiguration properties in
endpoint.
<endpoint address="SOAP"
binding="basicHttpBinding"
contract="IService"
bindingConfiguration="SecureBasicBinding"
/>
<endpoint address="REST"
binding="webHttpBinding"
contract="IService "
bindingConfiguration="SecureWebBinding"
/>
IIS Changes
1. Create Server
Certificate
In connections
section select root node than double click on server certificate.

In right pane click on “Create
Self-Singed Certificate”. Give certificate name and click on OK. One
certificate is created.
2. Set certificate
to HTTPS
Click on your web
site and select bindings from right pane.
Click on Add and
select type as “https” and select the SSL Certificate that you created.
Click on OK.
3. Now select SSL Settings of
the web site. Check on “Require SSL”. From right pane click on Apply.
Restart you web
site.
Your web site is
ready to use over HTTPS.
Conclusion
So, in this article we have
learned to expose WCF service over HTTPS we have to do some setting changes in
web.config as well as in IIS. Hope this
will help you.