zoukankan      html  css  js  c++  java
  • 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());
                });
    
  • 相关阅读:
    妙味——字符串方法2
    妙味——字符串方法
    [LeetCode][JavaScript]Shortest Palindrome
    [LeetCode]Kth Largest Element in an Array
    [LeetCode][JavaScript]Word Ladder
    [LeetCode][SQL]Second Highest Salary
    [LeetCode][JavaScript]Clone Graph
    [LeetCode][JavaScript]Merge k Sorted Lists
    [LeetCode][JavaScript]Merge Two Sorted Lists
    [LeetCode][JavaScript]Valid Sudoku
  • 原文地址:https://www.cnblogs.com/guxingy/p/13825624.html
Copyright © 2011-2022 走看看