HTTP Error - 405.0 Method Not AllowedRSS

1 reply

Last post Feb 16, 2021 06:45 AM by Brucz

  • HTTP Error - 405.0 Method Not Allowed

    Feb 15, 2021 06:33 PM|Renjuz|LINK

    I am creating a website that runs on Angular 10 as frontend and  enitity web API as backend. Many of my Angular pages push information to the next page via "POST". When submitting information from a Angular form using "POST" I receive the following error:

    <div id="x_x_x_x_content"> <div>

    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.

    </div> <div><fieldset>

    Most likely causes:

    • The request sent to the Web server used an HTTP verb that is not allowed by the module configured to handle the request.
    • A request was sent to the server that contained an invalid HTTP verb.
    • The request is for static content and contains an HTTP verb other than GET or HEAD.
    • A request was sent to a virtual directory using the HTTP verb POST and the default document is a static file that does not support HTTP verbs other than GET or HEAD.
    </fieldset></div> <div><fieldset>

    Things you can try:

    • Verify the list of verbs enabled for the module handler this request was sent to, and ensure that this verb should be allowed for the Web site.
    • Check the IIS log file to see which verb is not allowed for the request.
    • Check the failed request tracing logs for additional information about this error. For more information, click here.
    </fieldset></div> <div><fieldset>

    Detailed Error Information:

    <div id="x_x_x_x_details-left">
    Module    StaticFileModule
    Notification    ExecuteRequestHandler
    Handler    StaticFile
    Error Code    0x80070001
    </div> <div id="x_x_x_x_details-right">
    Requested URL    http://localhost:62510/Register.html
    Physical Path    C:\Users\********\Documents\Visual Studio 2015\WebSites\Prismlib\Register.html
    Logon Method    Anonymous
    Logon User    Anonymous
    Request Tracing Directory    C:\Users\********\Documents\IISExpress\TraceLogFiles\PRISMLIB
    <div></div> </div> </fieldset></div> <div><fieldset>

    More Information:

    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.

    </fieldset></div> </div>

    I have tried changing the web.config file and adding/removing various handlers and modules , but it did not fix the issue.

    What do I need to do to resolve this error?

  • Re: HTTP Error - 405.0 Method Not Allowed

    Feb 16, 2021 06:45 AM|Brucz|LINK

    Hi Renjuz,

    This problem occurs may because two reasons. Client makes a request by using an HTTP method but doesn't comply with the HTTP specifications and the post request is handled by Static File handler. I think your reason is second one because request page is Register.html.

    Whatever IIS or other server, by default the web server doesn't allow POST verb on .html page. So you can change the handler so that this request will not be handled by StaticFile. For example change .html page to .asp or .aspx page. Request will be handled by ASPClassic.

    Another solution is changing POST request to GET request so that StaticFile handler can handle it.

    Best regards,

    Brucz

    .NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.