How can I have MVC 6 return 405 Method Not Allowed instead of 404 Not Found?
问题 It appears that MVC 6 does not return 405 Method Not Allowed responses when a route matches except for the verb. This is, in my opinion, a regression from Web API 2 because it's not as RESTful. Is there an easy way to change this behavior? 回答1: This is not possible with MVC 6's current implementation. A sad oversight, and one that, along with other abstraction failures on Microsoft's part, drove my team and I to use NancyFx. https://github.com/aspnet/Mvc/issues/388 来源: https://stackoverflow