stiank81
stiank81

Reputation: 25686

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.

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

Upvotes: 5

Views: 3661

Answers (4)

MorgueFLB
MorgueFLB

Reputation: 21

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.

Upvotes: 2

Simon_Weaver
Simon_Weaver

Reputation: 145880

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

Upvotes: 1

code-zoop
code-zoop

Reputation: 7370

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

Upvotes: 3

Shiraz Bhaiji
Shiraz Bhaiji

Reputation: 65361

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.

Upvotes: 1

Related Questions