WCF - Hello, World


WCF stands for Windows Communication Foundation. WCF is a unified programming model for building service oriented application. WCF is the next generation of distributed applications and Web Services. It consist of a runtime and classes in System.ServiceModel namespace.

To Create a WCF Hello World, Here are the steps you need to do:
1. Fire up Microsoft Visual Studio 2008.
2. Go to File - New - Project and you can see New Project dialog box open.
3. Select Project Type Ex. Visual Basic or Visual C# and then select WCF underneath.
4. Select Wcf Service Library in Templates.
5. Type Name: HelloWorldService, Select location where you want to save your service.
6. You can verify by looking to the below image and then click OK


7. Now you need to edit the IService1.cs file. Remove the unwanted code that is automatically created by the Microsoft Visual Studio and make it as the image below:


8. Now edit the Service1.cs file and type the code as shown in the below image:
 
Step-I

Step-II

Step-III

9. Now you need to Build and Run your application. If your WCF application is error free you will get the next image screen.


10. Now double click the SayHello() method and write you name in Value area as I have add Robert and then press invoke button as shown in below image.


11. You will receive a small Pop-Up. Just click OK and your Done. In the Response area you will find the output of your Service.

No comments:

Post a Comment

Recent Posts