ASP.NET Web Api: The requested resource does not support http method 'GET'

后端 未结 11 742
傲寒
傲寒 2020-12-04 18:50

I\'ve got the following action on an ApiController:

public string Something()
{
    return \"value\";
}

And I\'ve configured my routes as f

11条回答
  •  南笙
    南笙 (楼主)
    2020-12-04 19:22

    Replace the following code in this path

    Path :

    App_Start => WebApiConfig.cs

    Code:

    config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{action}/{id}/{Param}",
                defaults: new { id = RouteParameter.Optional,
                                Param = RouteParameter.Optional }
                              );
    

提交回复
热议问题