c# - Asp.Net Web Api Versioning with Load Balancer (Layer 4) -


I am currently in charge of the development of a complex complex restore API with Net and Web APIs.

The interface will later be consumed by various public and private (at home) customers. I read a lot about my API, but the opinion seems very different.

The application runs behind load balancer in a multi server environment.

Now my problem is, the load balancer is strictly restricted and only supports layer 4 load balancing, so to inspect the URL / headers etc. of incoming requests, they have to route the correct version of the application. I'm not able to.

We do not want to update the API controllers in our code base because we have many external dependencies that should be updated frequently, so we can break some functionality.

At present, this is the solution to using a subdomain for only one example, e.g.

ver1.api.domain.com

Is there anything against this approach, do you have other ideas?

The issue with that variant approach is that there will be duplicate entries for all resources including all modifications.

In my opinion, a better way to incorporate a resource version into one Uri is to take a look at a solid example. Assume that there is a kind of car controller below:

  Public-class carnotrancer: API controller {[Route ("car / iid}")] Public ASINK Tasks & lt; IH.T.Pection Results & gt; Get (int id) {DoSomething (); Return is fine (result); After the first release, we present another version of the Get method, we can do something like  

[root ("car / {id} / v2")]

  Public Async Tasks & lt; IHttpActionResult & gt; GetCarsVersion2 (Intro ID) {DoSomethingElse (); Return is fine (result); }   

Therefore, the existing clients still mention the old Uri / car / {id} , while the new customer new Uri / Car / {ID} / V2 .

In addition, if there are not many differences between the two versions, the original implementation can be re-applied to meet the new requirements. Which turns, reduces code repetition.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -