博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Generating WCF Proxy using SvcUtil.exe
阅读量:5961 次
发布时间:2019-06-19

本文共 1887 字,大约阅读时间需要 6 分钟。

Visual Studio 2008 has made our with the ability to self-host the services and also allow debugging in our service.

What if we were pushed to a situation wherein we need to use the tool to create our proxy for the client…hmm… :)

To do so, we need to have our service running. Once the service is up and running, we could generate the proxy by the following command (replace the tags correspondingly) :

1: svcutil /t:code http://
2:       /out:
.cs /config:
.config

Here is my example :

1: C:\Users\Chaks\Documents\Visual Studio 2008\Projects\MyService\MyServiceHost>
2: svcutil /t:code http://localhost:8731/Design_Time_Addresses/MyService/WcfService/
3: /out:MyServiceProxy.cs /config:MyServiceProxy.config
4: Microsoft (R) Service Model Metadata Tool
5: [Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.648]
6: Copyright (c) Microsoft Corporation.  All rights reserved.
7: 
8: Attempting to download metadata from 'http://localhost:8731/Design_Time_Addresse
9: s/MyService/WcfService/' using WS-Metadata Exchange or DISCO.
10: Generating files...
11: C:\Users\Chaks\Documents\Visual Studio 2008\Projects\MyService\MyServiceHost\MyS
12: erviceProxy.cs
13: C:\Users\Chaks\Documents\Visual Studio 2008\Projects\MyService\MyServiceHost\MyS
14: erviceProxy.config

Now we can add this .cs file to the Client project and copy the .config file contents to the Client’s app.config file and execute the client 8)

We can also instruct svcutil to generate the proxy in the preferred language we want :

1: svcutil /t:code /language=VB
2:      http://localhost:8731/Design_Time_Addresses/MyService/WcfService/
3:          /out:MyServiceProxy.vb /config:MyServiceProxy.config

But svcutil already identifies the language with the extension of our output file name 8)

转载于:https://www.cnblogs.com/weishuai/archive/2011/11/30/2269310.html

你可能感兴趣的文章
Gradle2.0用户指南翻译——第五章. 疑难解答
查看>>
make[1]: *** [/usr/local/pcre//Makefile] Error 127
查看>>
数据库内核月报 - 2017年12月
查看>>
killws 利用xfire部署webservice (xfire1.6+spring1.6+maven 进化版)
查看>>
【ZooKeeper Notes 27】ZooKeeper管理员指南——部署与管理ZooKeeper
查看>>
关于Exchange Server 2010中无法装入指定的数据的解决方法
查看>>
数据链路层的主要功能与服务
查看>>
Exchange server 2016 无人值守安装
查看>>
使用组策略配置Windows 7的高级防火墙
查看>>
ZoneMinder配置与使用
查看>>
程序员,请不要抢系统管理员的饭碗
查看>>
补码[基础]
查看>>
两个乒乓球队进行比赛问题
查看>>
POJ2709 Painter 贪心算法
查看>>
oc-10-对象做参数
查看>>
Windows Azure Cloud Service (10) Role的生命周期
查看>>
二、Axis2的简单WebService示例
查看>>
接口的显示实现和隐式实现
查看>>
安装EBS前期检查工具 - RDA - Health Check / Validation Engine Guide 2 结果
查看>>
Windows Phone笔记(11)使用独立存储(下)
查看>>