【发布时间】:2014-02-21 17:09:22
【问题描述】:
我已经构建并编译了我的 WCF 客户端以成功运行。我发现只要这两个文件放在一起,我的客户端就可以在我电脑上的任何地方运行: 客户端.exe 客户端.exe.config
当我将这些文件移动到另一台计算机时,出现错误:
System.InvalidOperationException: Could not find default endpoint element that
references contract 'Service.IService' in the ServiceModel client configuration
section. This might be because no configuration file was found for your
application, or because no endpoint element matching this contract could be
found in the client element.
我已经确保可以从计算机的预期主机访问服务 URL。
查找问题后,似乎解决方案是复制从执行中检索到的配置:
svcutil http://host/Service.svc
到应用程序配置文件。但是,当我构建项目时,配置信息已经在 App.config 文件中。
我是否需要在每台打算使用 WCF Web 服务的客户端计算机上重新编译/构建?
【问题讨论】:
-
您只需要将 client.exe.config 与 client.exe 放在同一文件夹中。
-
是的,已经这样做了
标签: wcf client svcutil.exe