Thursday, July 23, 2015

WebDAV error "HTTP Error 405.0 - Method Not Allowed" using WebAPI

This morning I ran into this error on our .Net WebAPI project:

 "HTTP Error 405.0 - Method Not Allowed. The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used."
"This error means that the request sent to the Web server contained an HTTP verb that is not allowed by the configured module handler for the request."

This is after we did the excellent fix suggested at

The problem turned out not to be that the handler was not configured to handle a GET, but that my routing was ambiguous. I edited WebApiConfig.cs and modified the routing to be more specific. Now it works like magic.

(Note to Microsoft: Not to be whiny, but would it be so hard to give us an error like, "ambiguous route"?).

No comments: