WCF - Hosting
WCF service can be hosted in following ways:
- 1. Self Hosting
- 2. IIS Hosting
- 3. WAS Hosting
- 4. Windows Service Hosting
Self Hosting: Hosting in Console or Desktop Application
You can host the wcf service in console application or desktop application. This is the most easiest way to host wcf service. But you(developer) have to take care of host start and stop. It supports all type of bindings but the major disadvantage is limited availability as the wcf service is available only when the service is running.
IIS Hosting: Hosting in Internet Information Services(IIS)
When WCF service hosted in IIS it is integrated with ASP.NET and uses its features like message based activation, process health monitoring, process recycling and idle shutdown. IIS hosting is preferred hosting on Windows XP and Windows Server 2003(IIS 5.1 and IIS 6.0) and supports only HTTP hosting. From IIS 7.0 onward it supports WAS benefits too.
WAS Hosting: Hosting in Windows Activation Service
Windows Activation Service is introduced in IIS 7(Windows Server 2008 and Windows Vista). Windows activation service supports the IIS 6.0 features and in addition it removes the dependency on HTTP and supports all types of hosting such as tcp, named pipes and msmq.
Windows Service Hosting: Hosting in Windows Service
WCF Service that is implemented as both windows service and WCF service will be hosted in Windows Service Hosting. Like self hosting developer need to write additional code in OnStart() and OnStop() methods and the life time of the service is controlled by operating system.