webapi用Swashbuckle.AspNetCore报Internal Server Error /swagger/v1/swagger.json错误,解决

webapi用Swashbuckle.AspNetCore报Internal Server Error /swagger/v1/swagger.json错误,解决_第1张图片

解决办法
必须要将所有的action方法头都要加上 [Route(“api/report/page”)],比如[HttpPost(“TargetSourse”)],比如 [Route(“api/report/page”)],此处为简写

参考代码

    [Route("[controller]")]
    public class ChartDataController : Controller
    {
        /// 
        /// 获取各个指标的源数据
        /// 
        /// 
        [HttpPost("TargetSourse")]
        [TokenFilter]
        public async Task TargetSourse([FromBody]TargetParames parames)
        {
        //方法体
        }

你可能感兴趣的:(asp.net,core,swagger)