Windows Communication Foundation (WCF) is a programming interface as part of .NET Framework.
Using three types we can host service in WCF:
This self-hosting service is reachable only when the application that hosts the service is running. So, self-hosting is only suitable when the development and demonstration phase of your system.
There are two main advantages of using IIS over self-hosting:
Using three types we can host service in WCF:
- Self-Hosting
- IIS Hosting
- WAS
1. What is Self Hosting
WCF comes with System.ServiceModel.ServiceHost class that makes you can host your services in your own application easily. With Self Hosting what you need to do is just configuring your service endpoint and calling the .open() method of ServiceHost. To host WCF service you need WCF runtime and .NET application where you want to host your service.2. What are the advantages and Disadvantages of Self hosting
Advantages of Self Hosting:- It is Easy: This way of hosting don’t need many lines of code to successfully run.
- It is Flexible: You can easily decide when your service active by calling the .open() and .close() method.
This self-hosting service is reachable only when the application that hosts the service is running. So, self-hosting is only suitable when the development and demonstration phase of your system.
There are two main advantages of using IIS over self-hosting:
- Automatic activation
- Process recycling
3. What is ServiceHost in Self Hosting
- A Service Host basically provides you everything you need to host a WCF service in a non-IIS or WAS setting. A common place for a ServiceHost would be in a console app or Windows service.
- You can either instantiate a Service-Host class yourself in a console app, a Windows service, or even a Win-forms app, and thus make your WCF service class available to the outside world or you can delegate that work to IIS or WAS.
- Even IIS or WAS will use a ServiceHost to host your WCF service - they just do it automatically behind the scenes, and "on demand" - whenever a request for your WCF service comes in.
No comments:
Post a Comment