As we want to develop a new product using Asp.Net MVC 3. The key point here is everything we talk to database by WCF web service.
We are in the phase where we need to decide whether we host WCF web service in IIS OR self hosting with Windows Service.
I raised this question just because I want to know that, what would be the better option to host WCF service that would satisfy my below conditions.
Please do let me know whether I go for IIS hosting OR self hosting with Windows service.
Thanks in advance.
(Could anybody please suggest on this as this is a very crucial part to have decision for further process.)
Hosting Mechanisms − Various activation mechanisms are there for WCF hosting, i.e., IIS (Internet Information Service), WAS (Windows Activation Service), Self-hosting and Windows Service, but a web service is hosted only by IIS.
There are three types of hosting environments for WCF services: IIS, WAS, and self-hosting. The term “self-hosting” refers to any application that provides its own code to initialize the hosting environment. This includes console, Windows Forms, WPF, and managed Windows services.
In short, you can't. A more detailed answer is that there are 2 problems: IIS worker processes are launched only when a HTTP request comes in. This means you can't start your service with the system.
This hosting option consists of registering the application domain (AppDomain) that hosts a WCF service as a managed Windows Service (formerly known as NT service) so that the process lifetime of the service is controlled by the service control manager (SCM) for Windows services.
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. For more information about how to configure IIS hosting for a WCF service, see How to: Host a WCF Service in IIS. IIS-hosted services can only use the HTTP transport.
4.5. Hosting in a Windows Service - Learning WCF [Book] Windows services are the most useful of the self-hosting environments for WCF services. In fact, for services deployed in a production server system, the Windows service is the only practical self-hosting choice for a few reasons:
Self-Hosting in a Managed Application. WCF services can be hosted in any managed application. This is the most flexible option because it requires the least infrastructure to deploy. You embed the code for the service inside the managed application code and then create and open an instance of the ServiceHost to make the service available.
You might interest, This is the "general decision tree" from "Programming WCF Services", Juval Lowy.
Choosing a host for an Internet service: For an internet application (that is, an application that receives calls from clients across the Internet)
Choosing a host for Intranet service:
For an intranet application (that is, an application that receives calls from clients within
the same intranet),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With