我刚刚在控制器中添加了另一个 post 方法,Swagger Swashbuckle 崩溃了。如何解决这个问题?
[HttpPost]
public IActionResult CreateCars(List<Car> cars)
{
_carService.CreateCars(cars);
return NoContent();
}
System.NotSupportedException: HTTP method "POST" & path "api/Cars" overloaded by actions - IrkcnuApi.Controllers.CarsController.Create (WebApi),MyWebAPI.Controllers.CarsController.CreateCars (MyWebApi). Actions require unique method/path combination for OpenAPI 3.0. Use ConflictingActionsResolver as a workaround
at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GenerateOperations(IEnumerable`1 apiDescriptions, SchemaRepository schemaRepository)
at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GeneratePaths(IEnumerable`1 apiDescriptions, SchemaRepository schemaRepository)
at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GetSwagger(String documentName, String host, String basePath)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
SMILET
UYOU
HUX布斯