【问题标题】:How can I prevent VS2010 to create a new binding each time I update a service reference?每次更新服务引用时,如何防止 VS2010 创建新绑定?
【发布时间】:2011-09-26 17:08:53
【问题描述】:

我正在用 C# 3.5 和 Visual Studio 2010 开发一个带有 WCF 服务的 Winforms 客户端应用程序。

每次我在 IDE 中使用“更新服务参考”时,考虑到我已经在 app.config 中有一个有效的绑定,会生成一个具有相同名称和尾随“1”的附加绑定条目”。

我在客户端的 app.config 是:

<bindings>
  <wsHttpBinding>
     <binding name="WSHttpBinding_IIssueTracker" closeTimeout="00:01:00"...

在“更新服务参考”之后,我有:

<bindings>
  <wsHttpBinding>
     <binding name="WSHttpBinding_IIssueTracker" closeTimeout="00:01:00"...
     <binding name="WSHttpBinding_IIssueTracker1" closeTimeout="00:01:00"...

所以我需要一直删除这个未使用的绑定。

这让我发疯了。有没有办法禁用这种行为?

【问题讨论】:

    标签: wcf visual-studio-2010 app-config wcf-binding


    【解决方案1】:

    我们解决这个问题的方法是将服务引用移动到一个单独的库中,并在执行更新服务引用后从库项目中删除(新生成的)app.config。

    【讨论】:

    • 我试过这个:效果很好。我什至觉得我的项目结构看起来更干净。非常感谢!
    • 我通常只是恢复对 app.config 的任何更改(使用 SVN)...同样有效,不需要其他项目。我在这里有同样的问题,但并没有真正按照我的喜好解决:stackoverflow.com/questions/4625743/…
    猜你喜欢
    • 2013-03-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-23
    • 1970-01-01
    • 2017-10-28
    • 1970-01-01
    • 2018-07-19
    相关资源
    最近更新 更多