swagger .net core API ambiguous HTTP Action debugging
This can occur when a method is declared public in a controller, but without REST attributes. Changing the method to protected may address the issue.
I have seen this error before and usually the errormessage points to the culprit:
EBisAPI.Controllers._class.HandleError
I guess HandleError
is a public
method in your base class, right? Change it to protected
and try again.
The Clean way could be using data annotation [NonAction]
instead to set your method as protected.
I solved this error by decorating the method mentioned in the error with the correct HTTP attribute. For exemple: [HttpGet]
This code throws error:
public object Get()
{
MongoDbContext dbContext = new MongoDbContext();
return new {
API = true,
Database = dbContext.Status()
};
}
This code works:
[HttpGet]
public object Get()
{
MongoDbContext dbContext = new MongoDbContext();
return new {
API = true,
Database = dbContext.Status()
};
}