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