Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the WCF host

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to use WCF host, Xiaobian think it is very practical, so share it with you as a reference, I hope you can gain something after reading this article.

Each WCF service must be hosted in a Windows process (called the host process). A single hosting process can host multiple services, and the same service type can be hosted in multiple processes. WCF hosts do not require that the host process is also a client process.

Obviously, there should be a separate process supporting error and security isolation. Furthermore, it is not a matter of substance who provides the process or what type of process is invoked. This WCF host can be provided by IIS or Widows Activity Service (WAS) in Windows Vista or by the developer as part of the application.

IIS Host

The main advantages of hosting a service in IIS are that the hosted process is automatically started upon client request and you can rely on IIS to manage the lifecycle of the hosted process. The main disadvantage of IIS hosting is that you can only use HTTP to transfer data on IIS5 and IIS6; and when using IIS5, you can only use port 80. Hosting on IIS is very similar to WCF hosting a typical ASMX Web service. You need to create a virtual directory under IIS and provide a.svc file. The.svc file functions just like a code-behind file used to identify services and classes.asmx files.

You can even inject service code inline into the.svc file, but this is not recommended (as is the case with ASMX). Once you have the.svc file ready, you can use a browser to view it. If all goes well, you will get a confirmation page.

Visual Studio 2005 can generate a new IIS hosted service for you. Just select "New Website" from the File menu and select WinFX Services from the "New Web Site" dialog box. This enables Visual Studio 2005 to create a new Web site, service code and matching.svc file. In addition, the Web site profile must enumerate the types of services you want exposed. You need to use fully qualified type names (including assembly names) if the type comes from an unreferenced assembly.

... About "how to use WCF host" this article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it to let more people see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report