【发布时间】:2011-06-20 01:38:35
【问题描述】:
对于我的 WCF,我需要为我的客户端应用程序生成配置文件,以指定诸如服务绑定、服务地址和合同之类的内容。
【问题讨论】:
标签: wcf
对于我的 WCF,我需要为我的客户端应用程序生成配置文件,以指定诸如服务绑定、服务地址和合同之类的内容。
【问题讨论】:
标签: wcf
输入Microsoft Visual Studio Command Prompt:where svcutil.exe。在我的机器上它位于:C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\SvcUtil.exe
【讨论】:
Visual Studio 2015\Visual Studio Tools\Developer Command Prompt for VS2015 下的开始菜单中找到(至少对于 Visual Studio 2015)。
使用最新版本的 windows(例如 Windows 10,其他服务器),键入/搜索“开发人员命令提示符..”它将弹出 Visual Studio 版本的相关命令提示符。
更多https://msdn.microsoft.com/en-us/library/ms229859(v=vs.110).aspx
【讨论】:
如果您使用的是 vs 2010,那么您可以将其放入
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools
【讨论】:
尝试使用命令通过SvcUtil.exe生成代理类
语法:
svcutil.exe /language:<type> /out:<name>.cs /config:<name>.config http://<host address>:<port>
例子:
svcutil.exe /language:cs /out:generatedProxy.cs /config:app.config http://localhost:8000/ServiceSamples/myService1
要检查服务是否可用,请在没有 myService1 后缀的情况下尝试在您的 IE URL 中尝试
【讨论】:
查找任何文件位置
【讨论】:
我认为找到 Svcutil.exe 的位置并不是很重要。 可以不用绝对路径直接使用Visual Studio命令提示符执行,
Syntax:
svcutil.exe /language:[vb|cs] /out:[YourClassName].[cs|vb] /config:[YourAppConfigFile.config] [YourServiceAddress]
example:
svcutil.exe /language:cs /out:MyClientClass.cs /config:app.config http://localhost:8370/MyService/
【讨论】:
PATH。如果出于任何正当原因 svcutil.exe 不在任何 PATH 目录中,则如果没有绝对路径,则无法执行它。