Monday, September 7, 2009

How to: Host a WCF Service in IIS

How to: Host a WCF Service in IIS
This topic outlines the basic steps required to create a Windows Communication Foundation (WCF) service that is hosted in Internet Information Services (IIS). This topic assumes you are familiar with IIS and understand how to use the IIS management tool to create and manage IIS applications. For more information about IIS see Internet Information Services A WCF service that runs in the IIS environment takes full advantage of IIS features, such as process recycling, idle shutdown, process health monitoring, and message-based activation. This hosting option requires that IIS be properly configured, but it does not require that any hosting code be written as part of the application. You can use IIS hosting only with an HTTP transport.
For more information about how WCF and ASP.NET interact, see WCF Services and ASP.NET. For more information about configuring security, see Windows Communication Foundation Security.
For the source copy of this example, see IIS Hosting Using Inline Code.

To create a service hosted by IIS

  1. Confirm that IIS is installed and running on your computer. For more information about installing and configuring IIS see Installing and Configuring IIS 7.0
  2. Create a new folder for your application files called "IISHostedCalcService", ensure that ASP.NET has access to the contents of the folder, and use the IIS management tool to create a new IIS application that is physically located in this application directory. When creating an alias for the application directory use "IISHostedCalc".
  3. Create a new file named "service.svc" in the application directory. Edit this file by adding the following @ServiceHost element.



See full details: http://msdn.microsoft.com/en-us/library/ms733766.aspx

No comments: