Swashbuckle.aspnetcore: Actions require an explicit HttpMethod binding for Swagger 2.0

Created on 22 Dec 2018  路  5Comments  路  Source: domaindrivendev/Swashbuckle.AspNetCore

System.NotSupportedException: Ambiguous HTTP method for action - Blog.Core.Controllers.v1.ApbController.Get (Blog.Core). Actions require an explicit HttpMethod binding for Swagger 2.0\rn at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.CreatePathItem(IEnumerable1 apiDescriptions, ISchemaRegistry schemaRegistry)\r\n at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer1 comparer)\r\n at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.CreatePathItems(IEnumerable1 apiDescriptions, ISchemaRegistry schemaRegistry)\rn at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GetSwagger(String documentName, String host, String basePath, String[] schemes)\rn at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)\rn at Jom.WebApi.Config.ErrorHandlingMiddleware.Invoke(HttpContext context) in

Most helpful comment

1-remove parameters from HttpGet and let it [HttpGet]
2-add [Route] attribute and add routing parameters to it and it should work

All 5 comments

image

image

I can't call it after [CustomRoute(ApiVersions.v1, "fone")].

1-remove parameters from HttpGet and let it [HttpGet]
2-add [Route] attribute and add routing parameters to it and it should work

@tahazayed's suggestion fxed it for me.

Was this page helpful?
0 / 5 - 0 ratings