I am getting an exception when I have multiple action methods with same verb i.e. POST, in the Account controller of my newly setup WebApi project using default template in Visual Studio. Here's the info about VS:
Microsoft Visual Studio Enterprise 2019
Version 16.3.10
VisualStudio.16.Release/16.3.10+29519.87
Here is the exception that I get:
InvalidOperationException: The method 'post' on path '/api/Account' is registered multiple times.
Here is my the default routing setup in the Startup file:
app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
I have also tried the following but it didn't help.
endpoints.MapControllerRoute(
name: "api",
pattern: "{controller}/{id?}");
and
endpoints.MapControllerRoute(
name: "api",
pattern: "{controller}/{action}/{id?}");
I have read about the end point routing at the official docs as well, but I am not able to figure out what am I missing. You help is appreciated.