Skip to main content

Posts

Showing posts from February, 2014

WCF REST pt 4 Client

Open WCF service host project that you created OR create one based on instructions  here . Add a new project to the current solution: Right click Solution on Solution Explorer > Add > Add New Project Select Console Application template under Visual C# > Windows templates Change the project name to ConsoleClient and click OK In Solution Explorer, under ConsoleClient project, right click References and select Add Reference...  Add reference to ProductServiceLibrary, System.ServiceModel and System.ServiceModel.Web In the Program.cs file,  add  using System.ServiceModel; ** add  using System.ServiceModel.Web; add  using ProductServiceLibrary; ** Add the following code       namespace ConsoleClient {     class Program     {         static void Main(string[] args)         {                          WebChannelFactory<IProductService> factory = new WebChannelFactory<IProductService>(                 new Uri("http://localhost:8733/Design_Ti

WCF REST pt 3 site

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"  %>

WCF REST pt 2 Host

Open WCF RESTful service project that you created OR create one based on instructions  here . Add a new project to the current solution: Right click Solution on Solution Explorer > Add > Add New Project Select Console Application template under Visual C# > Windows templates Change the project name to ConsoleHost and click OK In Solution Explorer, under  ConsoleHost  project, right click  References  and select  Add Reference...   In the Reference Manager window, add reference to  System.ServiceModel ,  System.ServiceModel.Web , and  ProductServiceLibrary  solution Add  using  System.ServiceModel; Add  using  System.ServiceModel.Web; Add   using  ProductServiceLibrary; Add the following code in  Program.cs  file class Program     {         static void Main(string[] args)         {             Web ServiceHost host = new Web ServiceHost(typeof(ProductService));             try             {                 host.Open();                 Console.Rea