最佳答案
我在 APIController 上有以下动作:
public string Something()
{
return "value";
}
我的路线设置如下:
routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional }
);
在测试版中,这个工作得很好,但是我刚刚更新到最新的发布候选版本,现在我看到类似这样的通话出现了错误:
请求的资源不支持 http 方法“ GET”。
为什么这东西不管用了?
(我想我可以去掉{ action } ,只制作一大堆控制器,但是感觉很混乱。)