Different Types of WCF Hosting Environments

By implementing your own self-hosted service application, you can:

  • Add code to start and stop your WCF service when required.
  • Expose your WCF service over protocols other than Hypertext Transfer Protocol (HTTP).
  • Add additional code to get state information about the service host.

Windows Services:
This hosting option works by registering the application as a managed Windows service. Because the operating system controls the lifetime of the service, you can activate and start your WCF service as soon as the system starts. After it has started, the service runs silently in the background. Like the self-hosting option, this type of hosting environment requires that some hosting code is written as part of the application
The IIS hosting option enables:

  • Message-based activation, which creates a new instance of the service when a message arrives, rather than having a service running constantly.
  • Process recycling, which restarts the hosting process to clear the effects of memory leaks.
  • Idle shutdown, which stops and serializes the service after a given time to conserve system resources.
  • Process health monitoring, which enables you to respond to resource issues in the services.

IIS 7.0 includes WAS. Hosting your WCF service in WAS offers all of the benefits of hosting in IIS, including:

  • Message-based activation
  • Process recycling
  • Idle shutdown
  • Process health monitoring

Additionally, WAS is a generalization of IIS that is not bound to HTTP.
For more information about the possible hosting options, see Hosting and Consuming WCF Services

No comments:

Post a Comment