There are a few reasons why this error might occur. It is possible that a method you are using is not allowed - for example, if the client makes an HTTP request by sending the POST method to a page that is not configured to handle it. You may have an API which needs some argument but you are not passing those arguments from your Angular.
You can refer to several threads on MSDN and Stackoverflow where others have faced the same issue.
Here are some troubleshooting steps from the official Microsoft guide.
Cause 1: This problem occurs because the client makes an HTTP request by using an HTTP method that does not comply with the HTTP specifications.
Resolution 1:
Make sure that the client sends a request that contains a valid HTTP method. To do this, follow these steps:
- Click Start, type Notepad in the Start Search box, right-click Notepad, and then click Run as administrator.
Note: If you are prompted for an administrator password or for a confirmation, type the password, or provide confirmation.
- On the File menu, click Open. In the File name box, type
%windir%system32inetsrvconfigapplicationhost.config
, and then click Open.
- In the ApplicationHost.config file, locate the tag.
- Make sure that all the handlers use valid HTTP methods.
- Save the ApplicationHost.config file.
Cause 2: This problem occurs because a client makes an HTTP request by sending the POST method to a page that is configured to be handled by the StaticFile handler. For example, a client sends the POST method to a static HTML page. However, pages that are configured for the StaticFile handler do not support the POST method.
Resolution 2:
Send the POST request to a page that is configured to be handled by a handler other than the StaticFile handler (for example, the ASPClassic handler). Or, change the request that is being handled by the StaticFile handler so that it is a GET request instead of a POST request.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…