【问题标题】:Do I have to build the WCF Client for each machine its used on?我是否必须为其使用的每台机器构建 WCF 客户端?
【发布时间】: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


【解决方案1】:

我似乎已经通过复制整个编译文件夹解决了这个问题:

Client.exe
Client.config.exe
Client.pdb
Client.vshost.exe
Client.vshost.exe.config

我没有时间来回查看哪些文件子集是核心文件或所有这些文件是否都是必需的,但希望有人能跟进回答。

【讨论】:

    猜你喜欢
    • 2011-07-26
    • 2015-05-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多