Wcf – Handling versioning for clients when using WCF

wcf

Desktop clients will be pushing data using WCF to a central server.

When the schema changes etc, say 100 computers have the old version of the desktop client while the rest are using the latest build.

What do I have to do on the server end to handle both versions?
Do I create 2 endpoints in WCF or a single smart endpoint that will figure out the version and act accordingly?

note: i will be passing the version info from the client (if required that is)

Best Answer

You have a choice:

Firstly you should be versioning your service contracts anyway, with their namespaces; eg. http://idunno.org/2008/10/numpty would change to http://idunno.org/2008/11/numpty if the service operations have breaking changes.

Ditto with data contracts; however if all you are doing to the data contract is additive then you can mark the new fields as optional;

[DataMember(IsRequired="false")] 

And old clients will work. So this should indicate to you that the parameters into a service and parameters out should also be data contracts; it gives you that flexibility.

MSDN has more

Related Topic