3

Consider following scenario during development -

  1. We change WCF service contracts very frequently.
  2. There is a web application consuming these services.
  3. We do update, service reference frequently in the web application.

But at times when we forget to do this, we have to debug our whole web application, to finally find out that, the service contract has changed.

Can we detect outdated proxy at runtime before invoking the service.

Abhijeet
  • 13,562
  • 26
  • 94
  • 175

2 Answers2

2

The best practice is to version your service to allow the client to connect with the interface its familiar with. Usually you keep one or two versions older online and add any breaking changes as an up-rev to the service. (e.g. /myservice/2012/01 then /myservice/2012/06). Then as new versions are created you can deprecate previous versions.

Second practice would be to implement a GetVersion() (or similar) method you can call and use for testing purposes. Make an initial call to the service and see what it's running then test against a locally stored version number and see if a conflict exists.

For more detail on this, there's a good article by Yoav Helfman that goes over handling version changes and updates.

Brad Christie
  • 100,477
  • 16
  • 156
  • 200
1

I have posted about this kind of thing before.

Essentially one way to manage this situation is to require your service consumers to declare what version of the service interface they are expecting with each request.

Then expose a fault contract on your service of a type which will allow you to identify that a service version mismatch has occurred. This will mean that consumers can catch and then handle this specific problem accordingly.

Community
  • 1
  • 1
tom redfern
  • 30,562
  • 14
  • 91
  • 126