I have existing ASP.NET WebAPI which I want to migrate to ASP.NET Core WebAPI, but facing some issues in routing.
The APIs are already consumed by many clients and I cannot change the routes (or URLs). We have a controller (say ValuesController) with 2 Get methods but different parameters:
public async Task<IEnumerable<string>> Get(int xId, int yId)
public async Task<IEnumerable<string>> Get(int xId, int yId, int aId, int bId)
In current scenario (ASP.NET WebAPI), all the clients are able to call both methods on the basis of different parameters like:
For calling method first, one can request to URL:
http://localhost:4040/api/Values?xId=1&yId=2 and for second one, you can request to URL: http://localhost:4040/api/Values?xId=1&yId=2&aId=3&bId=4. And it get automatically decided by the current routing available with ASP.NET WebAPI
But in case of ASP.NET Core, if I request to the same URL, it throws the Microsoft.AspNetCore.Mvc.Internal.AmbiguousActionException: Multiple actions matched exception.
Any possible solution without changing the request call for every client application?