To publish a WCF service by using IIS

Source: Internet
Author: User

The previous article is a WCF service hosted by the Windows service, and now publishes the WCF service for the host with IIS.

The first step: Be sure to create a new WCF service "is a WCF Service Application" and then add a new project to the solution again "we choose the WCF Service Library and add this service library for the convenience of coding later." See

Step two: Delete the IService1.cs and Service1.svc.cs in the Wcfservice "We want to use the class in Wcfservicelibrary" and then add the reference Wcfservice in Wcfservicelibrary. Finally, we double-click Service1.svc, modify his statement instructions, and let his code point to the WCF Service Library project Wcfservicelibrary we established.

Modified before: <%@ ServiceHost language= "C #" debug= "true" service= "Wcfservice.service1" codebehind= "Service1.svc.cs"%>

After the modification is: <%@ ServiceHost language= "C #" debug= "true" service= "Wcfservicelibrary.service1"%> See:

Step three: We're going to start configuring Web. config, and we know that the core element of WCF's communication is the node "endpoints", and endpoint is made up of four parts: Address,binding,contract we are generally referred to as the ABC of WCF. Here we configure directly, do not write, see: Right-click Web. config, select "Edit WCF Configuration".

Fourth step: WCF configuration Diagram One: Click New Service

Figure II: Browse, add "the solution must first be rebuilt here."

Figure three: Configuration complete.

Fifth step: WCF will be published and placed on IIS. "We built a WCF service library Wcfservicelibrary Method GetData (), and we're going to call it on the client"

Right-click wcfservicelibrary---> Publish.

Sixth step: Open IIS, add the Web site, and select the. NET framework version in the corresponding application pool as consistent. Publish successfully, browse to see:

Seventh Step: Start the call and create a new console application. To add a service reference, see:

Eighth step: Complete the call and Debug. See:

To publish a WCF service by using IIS

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: info-contact@alibabacloud.com 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.