O'Reilly logo

RESTful .NET by Jon Flanders

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Hosting WCF RESTful Services

Once you’re ready to deploy your RESTful service using WCF, you’ll need to make a decision faced by every WCF service developer: where to host your service. The decision-making process should revolve around the capabilities that different hosting options can provide your endpoint. Those capabilities include process lifetime, process token, and security management, as well as general process management capabilities. In this chapter, we’ll examine the issues around hosting WCF services in your own process, which is known as self-hosting. We’ll also look at managed hosting, the name used to describe hosting WCF services inside of Internet Information Server (IIS).

WCF REST Hosting Isn’t a Special Case

Hosting a WCF service involves loading and running endpoints inside of an executable process. Because WCF is a CLR-based technology, you can host your endpoint inside of any executable process that can load the CLR. The main options are Windows Services, Windowed applications (like Windows Forms or Windows Presentation Foundation), or IIS.

WCF processes messages through a construct known as an endpoint. To start a WCF endpoint in a particular process, you must create a channel listener. Although there are a few ways to do this, by far the most common is to rely on the ServiceHost class to provide the infrastructure for loading up and starting channel listeners for endpoints configured on the ServiceHost instance.

An important thing to keep in mind when ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required