码迷,mamicode.com
首页 > Windows程序 > 详细

swagger--Failed to load API definition.

时间:2020-05-23 18:47:00      阅读:367      评论:0      收藏:0      [点我收藏+]

标签:pre   col   creat   生成   core   RoCE   process   意思   mamicode   

 

技术图片

 

 

 打开

http://localhost:5000/swagger/v1/swagger.json

 

提示错误

An unhandled exception occurred while processing the request.
NotSupportedException: HTTP method "GET" & path "api/Report/ExportUserRegisterData" overloaded by actions - XXX.Application.Report.ReportApplication.ExportUserRegisterData (XXX.Application),XXX.Application.Report.ReportApplication.ExportUserRegisterData (XXX.Application). Actions require unique method/path combination for Swagger 2.0. Use ConflictingActionsResolver as a workaround
Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.CreatePathItem(IEnumerable<ApiDescription> apiDescriptions, ISchemaRegistry schemaRegistry)

 

原因

有Get类型的重载的接口方法

 

解决方法

options.ResolveConflictingActions(apiDescriptions => apiDescriptions.First());

意思是swagger只会取其中一个Action

具体位置

//自动生成Api文档
            services.AddSwaggerGen(options =>
            {
                options.ResolveConflictingActions(apiDescriptions => apiDescriptions.First());
            });

 

swagger--Failed to load API definition.

标签:pre   col   creat   生成   core   RoCE   process   意思   mamicode   

原文地址:https://www.cnblogs.com/Zev_Fung/p/12943633.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!