如何在每次更新服务引用时阻止VS2010创建新绑定? [英] How can I prevent VS2010 to create a new binding each time I update a service reference?
问题描述
我正在使用C#3.5和Visual Studio 2010中的WCF服务开发Winforms Client应用程序.
I'm developing a Winforms Client application with a WCF Service in C # 3.5 and Visual Studio 2010.
每次我在IDE中使用"更新服务参考"时,考虑到我在app.config
中已经有一个有效的绑定,就会生成一个具有相同名称和尾随"1"的附加绑定条目. .
Every time I use "Update Service Reference" in the IDE, considering I have already a working binding in app.config
, an additional binding entry is generated with the same name and a trailing "1".
我在客户端的app.config是:
My app.config on the client side is :
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IIssueTracker" closeTimeout="00:01:00"...
在更新服务参考"之后,我有:
After a "Update Service Reference", I have :
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IIssueTracker" closeTimeout="00:01:00"...
<binding name="WSHttpBinding_IIssueTracker1" closeTimeout="00:01:00"...
所以我需要一直删除这个未使用的绑定.
So I need to remove this unused binding all the time.
这真让我发疯.有没有一种方法可以禁用此行为?
This is driving me nut. Is there a way to disable this behaviour ?
推荐答案
我们解决此问题的方法是将服务引用移至单独的库,并在执行Update之后从库项目中删除(新生成的)app.config.服务参考.
The way we solved this was to move the Service Reference to a separate library, and delete the (newly generated) app.config from the library project after executing Update Service Reference.
这篇关于如何在每次更新服务引用时阻止VS2010创建新绑定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!