Monday, 4 August 2014

Creating WCF Client from Service Metadata

Below are the steps to create WCF clients from service metadata using Visual Studio 2013:

I'm assuming you've a WCF service created and running on WCF Test client.

1. Open Visual Studio command prompt. You can find in under Start Menu -> All Programs -> Visual Studio Tools. If you're working on Windows 7, please make sure you "Run as administrator".
2. Type in the below command:

svcutil.exe /out:<OutputFileName>.cs /config:<configFileName>.config <Service URL>

For example:
If the service url is http://localhost:54225/TestService.svc

Type in the below command:
svcutil.exe /out:WCFGeneratedProxy.cs /config:output.config http://localhost:54225/TestService.svc

This will generate the proxy file and an output.config file. Add WCFGeneratedProxy.cs file to your project and add the content of output.config file to the web.config file.


No comments:

Post a Comment