Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF: Updating Service Reference gives duplicate config entries

I have a WPF application using service references to a WCF service. When doing updates on the service I need to update the service reference, so I right click it and hit "Update Service Reference".

Doing this results in duplicate entries in the App.config file of the client project.

  • It duplicates a binding under wsHttpBinding - adding an equal entry with postfix number in name: WSHttpBinding_ISomeService --> WSHttpBinding_ISomeService1.
  • And it duplicates the endpoint definition under binding such that there is one endpoint for each wsHttpBinding. This too is a pure duplicate except of the name.

Why does it duplicate the config? Isn't it just supposed to update the name? And how can I make it stop?

like image 702
stiank81 Avatar asked Dec 09 '09 10:12

stiank81


3 Answers

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

like image 81
code-zoop Avatar answered Oct 07 '22 01:10

code-zoop


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.

like image 43
MorgueFLB Avatar answered Oct 07 '22 02:10

MorgueFLB


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.

like image 25
Shiraz Bhaiji Avatar answered Oct 07 '22 03:10

Shiraz Bhaiji