response status is 500 https://localhost:7129/swagger/v1/swagger.json
阅读原文时间:2023年07月08日阅读:1

SwaggerGeneratorException: Conflicting method/path combination "GET Test" for actions - TodoApi.Controllers.TestController.get (TodoApi),TodoApi.Controllers.TestController.Table (TodoApi). Actions require a unique method/path combination for Swagger/OpenAPI 3.0. Use ConflictingActionsResolver as a workaround

TestCooontroller中GetTest出现路径重命名引起冲突

错误重现VisualStudio,新建ASP.NET Core WebAPI,http路径重复运行

using Microsoft.AspNetCore.Mvc;
using TodoApi.Model;
using TodoApi.Server;

namespace TodoApi.Controllers
{
    [ApiController]
    [Route("[controller]")]
    public class TestController :ControllerBase
    {
        [HttpGet("one")]//(“xxx”)与HttpGet做区分
        public int get()
        {
            var server = new TestServer();
            server.table();
            return 1;
        }
        [HttpGet]
        public List<Table_1> Table()
        {
            var server = new TestServer();
            var r=server.table();
            return r;
        }

        [HttpPost(Name = "post")]
        public  int Get1()
        {
            var server =  new TestServer();
            var conut =  server.Conut();
            return conut;
        }
    }
}