TechBubbles

WCF Sample in Visual studio 2008

Introduction

This post explains the procedure to develop the sample WCF Service and WCF Client  in Visual studio 2008. Get an overview on WCF and WCF Terms.

1. Start open  Visual studio 2008, Select new project option from file menu

WCF Start

2. Select the WCF ServiceApplication template from the project templates.

3. WCF Service describes the operations that perform in a service contract.

WCF-Service

4.Declare the service contract in Iservice.cs interface and implement in the above Service class.

WCF-Interface

5. To test this service, you will need to create a client and use it to call the

    service. You can do this using the svcutil.exe tool from the command line with

    the following syntax: Generating a client using svcutil.

  svcutil.exe http://localhost:53391/Service.svc?wsdl

WCFClient

6. The above command generates a code file and configuration file contains the client class. Add the two files to your client application and use the generated client class to call the service.

Generatedclient

7. Client class which call the service looks like

callingservice

8. The generated client configuration file looks like

ClientConfig

9. The service configuration file looks like

service-config

Conclusion

The above post explains shows the standard way to create a service and client and calling the service. The Next posts explains each feature in depth. 

Related Posts:

6 comments

6 Comments so far

  1. DotNetKicks.com August 21st, 2008 2:14 pm

    Developing WCF Sample in VS 2008…

    You’ve been kicked (a good thing) – Trackback from DotNetKicks.com…

  2. Madhavrao September 28th, 2008 5:13 am

    I think you missed one important point. Hosting of WCF Service. You haven’t covered it in your article. This blog I think is targeted towards beginner, so it should have been end-to-end solution. This is just constructive remark to your post. Nothing personal.

  3. [...] post explains how to host a WCF service that we defined in the previous article WCF sample in VS 2008. Specifically we host the WCF service in .NET console [...]

  4. scott July 20th, 2009 3:42 am

    this is great but i have no svcutil.exe in my c:/program files/microsoft visual studio 9.0 folder can you adivse on where i can get this tool thanks.

  5. amit September 10th, 2009 8:47 pm

    i found the svcutil.exe in: \program files\Microsoft SDKs\Windows\v6.0A

    worked great..

  6. Mike C. February 4th, 2010 10:00 pm

    @scott: Go to Start -> Programs -> Microsoft Visual Studio 2008 -> Visual Studio Tools

    and open Visual Studio 2008 Command Prompt, from there you can run svcutil.exe

Leave a reply