Hosting WCF 4.0 Service on IIS 7.5 with SSL
Posted by: Mahesh Sabnis ,
on 4/1/2010,
in
Category Windows Communication Foundation (WCF)
Abstract: This article is Part 2 of the two part series where I demonstrate how to create a certificate, create a WCF service that uses this certificate and finally host a WCF service on IIS 7.5 with SSL. In this article, we will see how to host a WCF service we created in Part 1, on IIS 7.5 with SSL.
Hosting WCF 4.0 Service on IIS 7.5 with SSL
Note: The same steps can also be followed for IIS 7.0.
Step 1: Open IIS 7.5 and create a new Application Pool. To do this, follow the steps shown below:
· Right click on ‘Application Pools’ and select ‘Add Application Pool’,
Remember you need to set the .NET Framework Version to 4.0, this will use ASP.NET 4.0 process to handle requests.
· Right Click on the Application pool you have created, and select ‘Advanced Settings’ from the ‘Process Model’ group and change the ‘Identity’ to ‘LocalSystem’ as shown below:
Step 2: Right click on the ‘Sites’ and select ‘Add New Web Site’. Provide ‘Site Name’, using ‘Select’ button and select the application pool which you have created in the ‘Step 1’. Provide a Physical Path for the web site. In the ‘Binding’, select ‘Https’. This will select the 443 port number. Once you select https, it will show a combobox for SSL certificate selection for the web site. Select the certificate which you have created. You will see the window shown below:
Step 3: To the web site you have created, right click and select ‘Add Application’ by following the screen shot below:
Step 4: Switch back to the VS2010 and to publish the WCF service in this web site, right click on the WCF Service and select ‘Publish’ as below:
(Note: By default you will have ’Web Deploy’ as ‘Publish Method’, change it to ‘File System’ and from the Target location, select ‘Local IIS’ and navigate to the web site and the application which you have created in previous step), the following window will be displayed:
Click on ‘Publish’.
Step 5: Switch back to IIS and expand the web site and application where the WCF service is published > switch to content view > you will see the following window:
Step 6: Right click on ‘Service.svc’ and click on browse, the browser will open the url with the following output:
This means that the certificate which we have configured is not issued by a trusted certificate authority. Now since we are just giving a demo here, the option of ‘Continue to this website’ can be selected. But remember that in a production scenario, you must be careful and resolve the certificate issue. So after selecting the continue option, the following output will be displayed:
Now the WCF service is successfully hosted. You can now use this service in your client application.
Conclusion: SSL provides an effective security mechanism for the communication between Client applications and WCF services.
This article has been editorially reviewed by Suprotim Agarwal.
C# and .NET have been around for a very long time, but their constant growth means there’s always more to learn.
We at DotNetCurry are very excited to announce The Absolutely Awesome Book on C# and .NET. This is a 500 pages concise technical eBook available in PDF, ePub (iPad), and Mobi (Kindle).
Organized around concepts, this Book aims to provide a concise, yet solid foundation in C# and .NET, covering C# 6.0, C# 7.0 and .NET Core, with chapters on the latest .NET Core 3.0, .NET Standard and C# 8.0 (final release) too. Use these concepts to deepen your existing knowledge of C# and .NET, to have a solid grasp of the latest in C# and .NET OR to crack your next .NET Interview.
Click here to Explore the Table of Contents or Download Sample Chapters!
Was this article worth reading? Share it with fellow developers too. Thanks!
Mahesh Sabnis is a DotNetCurry author and a Microsoft MVP having over two decades of experience in IT education and development. He is a Microsoft Certified Trainer (MCT) since 2005 and has conducted various Corporate Training programs for .NET Technologies (all versions), and Front-end technologies like Angular and React. Follow him on twitter @
maheshdotnet or connect with him on
LinkedIn