5

I was just looking to develop .NET WCF API. We may need to frequently update APIs.

How to manage multiple versions of API deployment?

Mitul Makadia
  • 398
  • 6
  • 24
  • firstly, your question seriously lacks quality. For a start you are asking three separate questions, so you should create three questions. Secondly, out of eight questions which have been answered, you have only awarded the answer on two of them. This will discourage people from helping you. Please revisit these questions and award the answer as appropriate. – tom redfern Jan 02 '12 at 18:50
  • Thanks hugh! I have updated question to narrow down. For the answers I received so far, I have awarded the answer on the questions where I find them as solution, rest of them are suggestions that are not leading to any appropriate solution. Hope you understand. – Mitul Makadia Jan 02 '12 at 19:31
  • If none of the answers you received led you to a solution then the correct thing to do is post the solution you arrived at and then mark this as the answer. Then people coming to your question can at least see how you managed to solve it. – tom redfern Jan 02 '12 at 19:39
  • Sure, I will make a note of it. – Mitul Makadia Jan 02 '12 at 19:40
  • Have removed my downvote. Also I had a go at answering your question. However I still think you need to work on this question. What you are asking is non-specific. It would be more useful for you and easier for us if you described the actual challenge you are facing. Then I can be more specific with my answer. – tom redfern Jan 02 '12 at 20:11
  • No, I haven't removed your downvote. I don't think even its possible. – Mitul Makadia Jan 04 '12 at 22:20

1 Answers1

6

Versioning your services is a huge topic with many considerations and guidelines.

For a start, there are different classes of changes you can make; fully-breaking, semi-breaking, and non-breaking.

Non-breaking changes (no change needed to existing clients) include:

  • changing the internal implementation of the service while keeping the exposed contract unchanged
  • changing the contract types in a way which does not break clients, for example, by adding fields to your operation return types (most serializers will raise an event rather than throw an exception when encountering an unexpected field on deserialization)
  • polymorphically exposing new types (using ServiceKnownType attribute)
  • changing the instance management settings of the service (per-call to singleton, sessionless to sessionful etc, although sometimes this will require configuration or even code changes)

Semi-breaking changes (usually can be configured on the client) inlcude:

  • changing the location of a service
  • changing the transport type a service is exposed across (although changing from a bi-directional to a uni-directional transport - eg http to msmq - can be a fully-breaking change)
  • changing the availability of the service (through use of service windows etc)

Fully-breaking changes (need new version of the client) include:

  • changing service operation signatures
  • changing exposed types in a breaking manner (removing fields, etc)

When you are going to make a semi or fully breaking change, you should evaluate the best way of doing this. Do you force all your clients to upgrade to use the new version, or do you co-host both versions of the service at different endpoints? If you choose the latter then how will you control and manage the propagation of different versionning dependencies which this may introduce?

Taken to an extreme, you could look into dynamic endpoint resolution, whereby the client resolves the suitable endpoint to call at runtime using some kind of resolver service.

There's good reading about this here: http://msdn.microsoft.com/en-us/library/ms731060.aspx

tom redfern
  • 30,562
  • 14
  • 91
  • 126
  • Thanks hugh! This will give a start. Let me get into the more detail. I am planning to deploy a service that is going to be consumed by native mobile apps. I would like to use some version number when accessing service URL i.e www.example.com/MyService/1.0/. I may need to periodically update native apps and add/update methods within my service and deploy it with different version number so I can have multiple versions of mobile apps and service running and then I can think of retiring older version of mobile app and service from time to time. – Mitul Makadia Jan 04 '12 at 22:25