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. 

Leave a reply

Why ask?