WCF is one of the best programming
models supplied by Microsoft for building more secure, reliable,
interoperable system for building, configuring and deploying
network-distributed services. WCF being a unified programming model that
has features of a Web Service, features of Remoting, and MSMQ and
others.
2. Remove all the predefined generated code from IService1 file and type as shown in the figure to create a Greeting method.
3. Now open the Service1.svc.cs file and implement the interface method.
4. Check the web.config file for the changes, comments are seft explanatory.
5.Build and run the service.
6. The WCF Service is ready and now we need to create a client application to test our service.
7. Add a new console application project to the solution name it as SampleClient
8. Now right click on the references and click on ServiceReference, Specify the address to locate the service and Set the namespace Click Ok.
9. Create an object of the proxy client class and call the Greeting method as shown.
10. Check the app.config file for configuration changes
11. Build and execute the application
Thats it ... its done.
In this first article we will discuss Step by step on how we to create a simple WCF service.
1. Start
visual studio and select a WCF service application template, Name the
project as WcfService1, choose a location to save this project.
3. Now open the Service1.svc.cs file and implement the interface method.
4. Check the web.config file for the changes, comments are seft explanatory.
5.Build and run the service.
6. The WCF Service is ready and now we need to create a client application to test our service.
7. Add a new console application project to the solution name it as SampleClient
8. Now right click on the references and click on ServiceReference, Specify the address to locate the service and Set the namespace Click Ok.
9. Create an object of the proxy client class and call the Greeting method as shown.
10. Check the app.config file for configuration changes
11. Build and execute the application
Thats it ... its done.
No comments:
Post a Comment