WCF: Updating Service Reference gives duplicate config entries

不想你离开。 提交于 2019-12-05 09:55:58

Which version of Visual Studio are you using? This is a known bug, which has been fixed in VS2010. Check out this link!

MorgueFLB

code-zoop says that this known bug is resolved in VS2010, but I'm getting it in VS2010 as well.

Happens when I manually modify the default value for the MaxReceivedMessageSize property (and others) of the basicHttpBinding in App.config (as per this post: WCF - How to Increase Message Size Quota)

Just thought I'd mention that this happens in VS2010 as well. For the moment, I'm taking Shiraz Bhaiji's advice and just deleting the duplicate, which seems to be working for the moment being.

This has also happend to us on a few occasions.

You need to remove the duplicate, otherwise it will crash at runtime. The client looks in the configuration file to find where it should send a request to Interface(WCF contract X), finds more than one, and crashes.

one workaround is to put the service agent (web reference) in its own DLL and reference it from the main project.

it won't touch your service agent config in your web.config when you do Update Referene and as a bonus you'll have a project with up to date serviceagent config if you ever need to compare the default configuration with what you actually have in web.config

also has the benefit that if you have one service agent referencing another it will share the types

MAIN DLL > ServiceAgent1 DLL > ServiceAgent2 DLL

If ServiceAgent1 and ServiceAgent2 have shared types you won't get two generated duplicate classes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!