4thSpace
4thSpace

Reputation: 44332

How to update WCF reference?

In Visual Studio (2013), is there a way to update a WCF reference without blowing it up?

If I update the reference to pull in a new type, it changes some of the return types to non generic. If I then configure the service and select to use generics, it completely changes some signature methods, which destroys the service. I have to delete all the generated files in the service reference folder and get the originals from the repository for it to work again.

The service works fine in the WCF Test Client. I can see the new type in the results. I just can't get it to update in an existing project.

Upvotes: 1

Views: 184

Answers (1)

tom redfern
tom redfern

Reputation: 31760

...is there a way to update a WCF reference without blowing it up?

Not really. When you update a service reference, the end result, while ultimately deterministic, is certainly unpredictable.

To avoid this, don't bother with service references at all. Just create a binary reference to the service contracts and use the WCF channel stack to call the service, as described here.

You can only do this if you have access to the service binaries though.

Service references have their place if you don't want to reference a contract assembly (possibly because it does not exist)

I agree service references have their place: that place is out on the public web, or, as you point out, any other situation where getting the service assemblies is impossible.

I am really struggling to think of a situation where it would be preferable to use a service reference over a binary reference if you have access to the service assembly.

I guess one reason may be that the types defining the service and operation/data contracts are bundled up in an uber-assembly with a bunch other stuff, but in that case the best thing to do would be to extract them into a separate assembly and have the service and consumer both reference it (ideally via NuGet).

Upvotes: 1

Related Questions