- Open WCF RESTful service host project that you created OR create one based on instructions here.
- Add a new website to the current solution: Right click Solution on Solution Explorer > Add > Add New Website
- Select WCF Service under Visual C# templates
- Change the folder name to ProductWCFService and click OK
- In Solution Explorer, right click on the ProductWCFService website and select Add Reference...
- Add reference to ProductServiceLibrary in solution
- In Solution Explorer, under ProductWCFService website, expand App_Code and delete two files IService.cs and Service.cs
- Open App.config file, remove the code from <System.ServiceModel> to </System.ServiceModel> inclusive.
- In the service.svc file, add replace the code with the one given below:
<%@ ServiceHost Language="C#" Debug="true" Service="ProductServiceLibrary.ProductService"
Factory="System.ServiceModel.Activation.WebServiceHostFactory" %>
Running the service
- To run the service site, right click on service.svc and select view in browser.
Comments
Post a Comment