Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Original product version: Internet Information Services 7.0 and later versions
Original KB number: 942051
Summary
This article helps you resolve the HTTP 405.0 error that occurs when you visit a website that's hosted on a server that runs Internet Information Services (IIS) 7.0 or a later version. This error can be caused by invalid HTTP methods, POST requests to static file handlers, WebDAV Publishing conflicts, or application code that returns an HTTP 405.0 response.
Symptoms
When you visit a website, you receive an error message that resembles the following example:
Server Error in Application "application name"
HTTP Error 405.0 - Method not allowed
HRESULT: 0x80070001
Description of HRESULT
The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used.
Cause: Invalid HTTP method
A client makes an HTTP request by using an HTTP method that doesn't comply with the HTTP specifications.
Solution
Make sure that the client sends a request that contains a valid HTTP method:
- Open Notepad as an administrator.
- On the File menu, select Open.
- In the File name field, type
%windir%\system32\inetsrv\config\applicationhost.config, and then select Open. - In the
applicationhost.configfile, locate the<handlers>tag. - Make sure that all the handlers use valid HTTP methods.
- Save the
applicationhost.configfile.
Cause 2: POST request sent to a static file handler
A client sends an HTTP request specifying the POST method to a page that's configured to be handled by the StaticFile handler. For example, a client sends the POST method to a static HTML page. Pages that are configured to use the StaticFile handler don't support the POST method.
Solution
Send the POST request to a page that's configured to be handled by a handler other than the StaticFile handler (for example, the ASPClassic handler). Or, change the request so that it uses the GET method instead of POST.
Cause 3: WebDAV Publishing interferes with HTTP PUT
WebDAV Publishing might interfere with HTTP PUT requests and cause HTTP 405.0 errors.
Solution
Remove WebDAV modules and handlers from the web.config file. If you don't use WebDAV Publishing, remove the feature from the IIS server:
- Select Start, enter
Turn Windows features on or offin the search box, and then select Turn Windows features on or off. - In the Windows Features window, expand Internet Information Services > World Wide Web Services > Common HTTP Features.
- Clear the WebDAV Publishing checkbox.
Cause 4: Application code returns an HTTP 405.0 response
Application code returns an HTTP 405.0 response to indicate an error.
Solution: Use a different HTTP status code
Use a custom status code instead of the predefined HTTP 405.0. For client errors, use the HTTP 400 status code together with a custom description that outlines the specific error.
Related content
- Troubleshoot Web API2 apps that work in Visual Studio and fail on a production IIS server
- Troubleshoot 4xx and 5xx HTTP errors
Third-party information disclaimer
The third-party products that this article discusses are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, about the performance or reliability of these products.