1: This simple WCF demo consists of 3 files: an interface (which defines the method provided by the service), 1 entity classes, and one. Svc file (method implementation process)
2. After writing the code for the Service, edit the WCF configuration file, if shown:
3. Write the configuration information in the endpoint and bindings of the client and save it.
4. Press F5 to run, the WCF test client will be invoked. If the service and configuration you are writing are normal, the client interface is:
Using this tool, you can test the data returned by methods in the interface, and a simple WCF service program is ready to write. The next step is to publish the WCF service to IIS
5. Right-click the solution and publish the WCF service to a folder
6. Add the folders generated after publishing to IIS, click Browse, and you can see that the WCF service published successfully in IIS
7, using the SvcUtil.exe tool, get the client file and configuration file of the service,
8. Copy the contents of <system.serviceModel> in client files and configuration files into Web. config, such as:
9. A reference to the WCF service has been completed, and the methods provided in the WCF service can be used in code.
Note: 1. Be sure to edit the WCF configuration file after you write the WCF service, otherwise you will not find an endpoint error when referencing in another program
2. Using SvcUtil.exe to generate client code and configuration files
3, after the completion of the WCF service, first press F5, with the WCF test client to determine whether the service is correct, this step is not through the other next is wasted
Writing and invoking a simple WCF service