拦截不存在的WebAPI操作的返回详细信息

时间:2018-12-19 11:04:35

标签: asp.net-web-api action

我有一个webapi控制器,当我通过邮递员或什至通过浏览器点击它时,对于不存在的操作,它会返回一个JSON

{
 "message": "No HTTP resource was found that matches the request URI'  http://localhost:65000/api/somecontroller/getsomething'.",
 "messageDetail": "No action was found on the controller 'somecontroller' that matches the name 'getsomething'."
}

如何避免返回此有效负载或URL反射。请提出任何建议?

谢谢

0 个答案:

没有答案