WCF: Generate Proxy Class and Configuration file for Client

1. please keep WCF service running

2. and two ways to achive this 

  a. add Service Reference (will not introduce this since there're so many resources on internet)

  b. use svcutil.exe to generate

use svcutil.exe to generate

a. open visual studio cmd and input commands as below

  - language means which language the code in GeneratedProxy uses. .cs mean c#

  - out means the output file into which the proxy class will be written.

  - config means config file path

  - URL means the wcf service URL from which we can get service metadata to generate client proxy class.

svcutil.exe /language:cs /out:D:\GeneratedProxy.cs /config:D:\app.config http://localhost:8000/ServiceModelSamples/service

 

b. Check the generated proxy and config file

 

GeneratedProxy.cs

 

 app.config

 

posted @ 2017-06-13 23:39  m苗子  阅读(460)  评论(0编辑  收藏  举报