After creating a WCF service, the next step is to host it so that the client applications can consume it. This is known as WCF service hosting. A WCF service can be hosted by using any of the four ways given below:
在创建wcf服务后,下一个步骤就是托管该服务,确保客户端应用可以使用它。这也被称为wcf服务托管。wcf服务可以使用下面4种中的任一一种方式进行托管
- IIS Hosting - IIS stands for Internet Information Services. Its working model is similar to that of ASP.NET while hosting a WCF service. The best feature of IIS hosting is that the service activation is processed automatically. IIS hosting also offers process health monitoring, idle shutdown, process recycling, and many more features to facilitate a WCF service hosting.
- Self-Hosting - When a WCF service is hosted in a managed application, it is known as self-hosting. It requires a developer to write the requisite coding for ServiceHost initialization. In self-hosting, a WCF service can be hosted in a variety of applications like Console application, Windows form, etc.
- WAS Hosting - Hosting a WCF service in Windows Activation Service (WAS) is most advantageous because of its features such as process recycling, idle time management, common configuration system, and support for HTTP, TCP, etc.
- Windows Service Hosting - For local system clients, it is best to host WCF service as a window service and this is known as Window Service Hosting. All the versions of Windows support this type of hosting and here, the Service Control Manager can control the process lifecycle of the WCF service.
IIS托管:互联网信息服务,在托管wcf服务的时候,它的工作模式类似于ASP.NET。IIS托管的最好的特性是:服务激活是自动处理的。IIS托管同样提供进程安全监视,空闲挂断,进程复用,以及许多其他的功能来促进wcf服务托管。
自托管:当一个wcf服务托管在一个托管应用上时,被称为自托管。这就要求开发人员为服务托管初始化编写必要的代码。在自托管中,wcf服务可以托管在许多应用上。比如控制台应用,winform应用等。
WAS托管:将wcf服务托管在windows激活服务上是最有利的,因为它包含如下功能:进程复用,空闲时间管理,公共配置系统,并且支持HTTP和TCP等
windows服务托管:对于本地系统客户端而言,将wcf服务作为windows服务来托管是最好的托管方式。所有版本的windows操作系统都支持这种类型的托管,服务控制管理器可以控制wcf服务的进程的生命周期。
时间: 2024-09-29 00:53:36