Hosting a WCF service in an IIS server
Another way to host a WCF service is in an IIS (Internet Information Services). It requires a physical file with a .svc
extension to host the service properly. Unlike the previous recipe, you won't need to write any code to create the instance of ServiceHost
. IIS automatically creates it for you while hosting the service.
In this recipe, we will learn how to publish an already created service to host inside the IIS server of Windows.
Getting ready
To get started, launch the Visual Studio IDE with administrative rights. To do so, right-click on the icon and click Run as administrator
. Now open the existing project CH09.EmployeeService
, which we have created earlier. Alternatively, you can also open the solution.
To proceed further, we assume that you are familiar with IIS and understand how to use the IIS management tool to create and manage IIS applications.
How to do it...
Let's follow these steps to host our service in an IIS server:
- First, you need to check...