Closed introspection3 closed 3 years ago
I really have no idea what you’re asking here - can you elaborate, a code example would help?
Connection id "0HLJ74RLO0OLB", Request id "0HLJ74RLO0OLB:00000002": An unhandled exception was thrown by the application.
System.NotSupportedException: Ambiguous HTTP method for action - Permission.Service.Controllers.RoleController.GetRoleConfigValue (Permission.Service). Actions require an explicit HttpMethod binding for Swagger 2.0
at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.CreatePathItem(IEnumerable1 apiDescriptions, ISchemaRegistry schemaRegistry) at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.<>c__DisplayClass6_0.<CreatePathItems>b__2(IGrouping
2 group)
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func
2 keySelector, Func2 elementSelector, IEqualityComparer
1 comparer)
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func
2 keySelector, Func2 elementSelector) 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.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
@domaindrivendev System.NotSupportedException: Ambiguous HTTP method for action - Permission.Service.Controllers.RoleController.GetRoleConfigValue (Permission.Service). Actions require an explicit HttpMethod binding for Swagger 2.0
only one GetRoleConfigValue method
Why can't I find anything on GetRoleConfigValue method? Anyone resolve this?
Is there a reason why you’re not decorating the action with the ”HttpGet” attribute? I’m assuming from method name that you want consumers to access via Http GET.
By omitting this, you’re actually exposing it via any Http verb. Is this really what you want?
Well, I don't have (source) control to the action method. It's in a 3rd party CMS authorization/login controller from a Nuget package....
@bbqchickenrobot we need a function just like asp.net webpi ,which can auto set HttpGet Delete....
Not sure what you mean.... there is an Action method on a (CMS) controller from a nuget package. I am using this nuget package (cms) along with my own web api. SwashBuckle finds all the methods including the Account.Login() method in the nuget package and then throws this error. Since the controller and its action method reside in a 3rd party nuget package (dll) I cannot decorate the action method with the appropriate HttpVerb attribute.
I think what you are saying is - then it just won't work....
the swagger in asp.net mvc (webpi) can work well,and it doesn't need us must add an HttpVerb attribute
the swagger in asp.net mvc (webpi) can work well,and it doesn't need us must add an HttpVerb attribute,so we can't migrate our old code to swagger core
ah! Got it... I figured out a band-aid hack.... I'll post the link here
https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/899
thanks,but when I manual set HttpVerb to all actions, I met another question: our route template is /api/contoller/action/{id}, the swagger core also can't work
thanks,but when I manual set HttpVerb to all actions, I met another question: our route template is /api/contoller/action/{id}, the swagger core also can't work
What I can Do when I can't give actions an explicit HttpMethod when Actions require an explicit HttpMethod binding for Swagger