• ABP Swagger 支持方法重载


    原文:
    https://www.cnblogs.com/asd14828/p/11136837.html

    报错

    ERROR 2020-10-16 11:31:20,598 [10   ] Microsoft.AspNetCore.Server.Kestrel      - Connection id "0HM3HGFH7B4U2", Request id "0HM3HGFH7B4U2:00000003": An unhandled exception was thrown by the application.
    System.NotSupportedException: HTTP method "POST" & path "api/services/app/ExcelImport/ExcelToDataSet" overloaded by actions - BIMMP.DataImporting.ExcelImport.ExcelToDataSet (BIMMP.Application),BIMMP.DataImporting.ExcelImport.ExcelToDataSet (BIMMP.Application). Actions require unique method/path combination for Swagger 2.0. Use ConflictingActionsResolver as a workaround
       at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.CreatePathItem(IEnumerable`1 apiDescriptions, ISchemaRegistry schemaRegistry)
       at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
       at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.CreatePathItems(IEnumerable`1 apiDescriptions, ISchemaRegistry schemaRegistry)
       at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GetSwagger(String documentName, String host, String basePath, String[] schemes)
       at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
       at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext)
       at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.Invoke(HttpContext httpContext)
       at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
       at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
       at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
       at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
       at Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.Invoke(HttpContext httpContext) in D:GithubaspnetboilerplatesrcAbp.AspNetCoreAspNetCoreSecurityAbpSecurityHeadersMiddleware.cs:line 26
       at Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware.Invoke(HttpContext httpContext)
       at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
    

    解决

                services.AddSwaggerGen(c =>
                {
                    c.ResolveConflictingActions(apiDescriptions => apiDescriptions.First());
                });
    
  • 相关阅读:
    nodeJs学习-10 模板引擎 ejs语法案例
    nodeJs学习-09 模板引擎 jade、ejs
    nodeJs学习-08 cookie、session
    nodeJs学习-07 express、body-parser;链式操作next
    RedHat6.5-Linux安装telnet服务
    druid数据源配置
    rpm安装MySQL
    黎活明给程序员的忠告
    为什么要使用JS模板引擎
    Angularjs调用公共方法与共享数据
  • 原文地址:https://www.cnblogs.com/guxingy/p/13825624.html
Copyright © 2020-2023  润新知