Monday, August 02, 2010

Implementing a Basic Hello World WCF Service

Introduction
In this article, we will manually implement a basic WCF service from scratch, step by step with clear instructions and precise screen snapshots. You will have a thorough understanding of what WCF is under the hood after you read this article. Visual Studio 2010 under Windows 7 will be used for all screenshots of this article.
We will build the WCF service manually from scratch, meaning we will not use any Visual Studio 2010 template to create the service. We will also create the host application and the test client application manually, including generating the proxy and configuration files manually with the tool svcutils.exe. In your real project, you can and should utilize Visual Studio 2010 to help with these tasks, but manually doing the actual work is a great way for you to understand what WCF is really like under the hood. This will help you to better understand the why of those WCF templates within Visual Studio.
We will build a HelloWorld WCF service by carrying out the following steps:
• Create the solution and project
• Create the WCF service contract interface
• Implement the WCF service
• Host the WCF service in the ASP.NET Development Server
• Create a client application to consume this WCF service
Creating the HelloWorld solution and project
Before we can build the WCF service, we need to create a solution for our service projects. We also need a directory in which to save all the files. Throughout this book, we will save our project source codes in the C:\SOAwithWCFandLINQ\Projects directory. We will have a subfolder for each solution we create, and under this solution folder, we will have one subfolder for each project.
Read more: Codeproject