Implementing Swashbuckle/Swagger with .net Core 2 API I am now receiving the 500 error when accessing swagger.json:
NotSupportedException: Ambiguous HTTP
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()
};
}