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 ...
Get RESTful .NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.