In earlier post I discussed Exposing WCF REST Service over HTTPS. Major limitation on service created in last post was its self-hosted nature. In this post, I will take same service forward and host in IIS. So at the end of this post, you would able to host WCF REST Service in IIS with HTTPS.

Configure IIS

To start with let us first configure a Web Site in IIS

Open IIS

a. Open the command prompt in administrator mode. To do click on Start button then type RUN in search and then in Run window type inetmgr to open IIS.


Now you will have IIS open like below


b. Right click on Sites and then click Add Web Site


c. Now a window will open.


Give any name of your choice as the site name. I am giving name here HostedWcfService


Now click on select and choose ASP.Net v4.0 from the drop down.


Now in the physical path section, we need to give physical path of the service. So to get the physical path of the service, right click on the WCF Service project in visual studio and click open project in windows explorer. Open the project in windows explorer and from address bar copy the path and paste that below. Or you can browse also. Just click on browse button and navigate to project folder of the WCF Service.


Now at the Binding section select HTTPS. Give any port number. I am leaving default port.


Again I am selecting DEBUGMODE certificate.

Note: steps to create certificate is in my previous post Exposing WCF REST Service over HTTPS

Configure WEB.Config

In last post we created a self-hosted WCF REST Service. Now we need to host service in IIS. So we need to configure EndPoint in Web.Config.

Open Web.Config of WCF Service

1. Add service End Point


IService1 is Service Contract name and svcBehavior is service behavior. And of course for REST service we are using webHttpBinding.

2. Create Service Behavior


3. Add Transport level security to webHttpBinding


WEB.Config will look like

<?xml version="1.0"?>
<compilation debug="true" targetFramework="4.0" />
<behavior name="svcBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<security mode="Transport"/>
<service name="WcfService13.IService1" behaviorConfiguration="svcBehavior">
<endpoint name="" binding="webHttpBinding" address="" contract="WcfService13.IService1" />
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<modules runAllManagedModulesForAllRequests="true"/>


Publish Service

Right click on WCF Service and click on Publish

1. Choose Web Deploy

2. At Site URL give any URL of your choice

3. In Site Application give name of site you created in beginning of this post.


In this post we saw how to host WCF REST Service in IIS with HTTPS. Thanks for reading. I hope it was useful.


4 thoughts on “Hosting WCF REST Service in IIS with HTTPS

  1. thank Dhananjay for this post, it works fine for me.

    Next question: How can I use basic aunthentication with https in iis

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s