Using IIS to host WCF services

Source: Internet
Author: User
Tags hosting

1. WCF can be easily hosted by IIS, which is similar to the model that ASP. NET and ASP. NET Web service uses.
2. WCF can be hosted on IIS versions on the following operating systems
    • IIS 5.1 on Windows XP SP2
    • IIS 6.0 on Windows Server 2003
    • Windows Server 2008 or Windows Vista or IIS 7.0 on Windows 7
    • and subsequent versions of IIS
3. In IIS 7.0, a new type of hosting service is provided, namely was (Windows process Activation service,windows Process Activation Service ), Use was to host WCF to allow protocols other than HTTP to be activated and network traffic. This environment is suitable for developing WCF services that can communicate with any network protocol that is supported by WCF, including HTTP, net.tcp, net,. pipe, and NET.MSMQ. In the was host, features in the was worker process can be used, such as automatic activation of services, health monitoring, and processes.
To use the was host, you only need to create a Web site and a work. svc file, where the ServiceHost declaration contains the language and name of the service class.
The following code uses the Service1 class. Also, you must specify the file that contains the service class. This class is implemented in the same way that you define a WCF service library.
<%@ ServiceHost language= "C #" debug= "true" service= "Service1" codebehind= "Service1.svc.cs"  %>
This is not the usual deployment of. svc Files4. Benefits of using IIS hosting:
    • You can deploy and manage WCF services hosted in IIS just as you would any other type of IIS application.
    • IIS provides process activation, run State management, and recycling to improve the reliability of hosted applications.
    • Like ASP. NET, the WCF services hosted in ASP. ASP can take advantage of the net share hosting model, in which multiple applications reside in a common worker process to increase server density and scalability.
    • WCF services hosted in IIS use the same dynamic compilation model as asp.net2.0, which simplifies the development and deployment of hosted services.
    • When IIS hosts WCF services, IIS5.1 and IIS6.0 are limited to HTTP traffic.
5, WCF specific writing and deployment and IIS here will not repeat the demonstration, specific cases can be consulted:WCF is deployed on IIS
WCF Getting Started tutorial one (hands-on new first WCF program and deploy)
WCF Getting Started Tutorial II

Small bet: 1, personal feeling with a hammer there is no need to hit the nail with the hand, so when WCF, using Visual Studio Bar, there is no need to use text files to create SVC and so on files. For example, a client application needs a proxy to access the service. There are 3 ways to create proxies for clients:
Visual Studio adds a service reference-this utility creates a proxy class from the metadata of the service.
The ServiceModel metadata utility svcutil.exe--uses the Svcutil utility to create a proxy class. The utility reads the metadata from the service to create a proxy class.
the Channeldfactory class-this class is used by proxies generated by the Svcutil utility, however, it can also be used to create proxies programmatically. personally or feel that Visual Studio is more automated than some2, it is said that the deployment of WCF, the need to activate the WCF HTTP activation components, the specific activation method is as follows:
after the installation is complete, you can see the following: Svc-integrated entry in the IIS Manager----handler mappings, indicating that the installation was successful
ButThe question is, when I deploy WCF, do I have to activate this service, and why does WCF work? Hope to have a friend to know to help answer, thank you.

Copyright: jiankunking Source: This article is copyright to the author and Csdn, Welcome to reprint, but without the consent of the author must retain this paragraph, and in the article page obvious location to the original connection.

Using IIS to host WCF services

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.