skip to Main Content

Below is the error I am receiving when trying to execute php in localhost. Its comes from when I click a form input that then executes the php which uses the ‘POST‘ request. The errors looks like its coming from a handler that doesn’t have the POST verb defined in it. My questions is, is how do I locate which handler this error is coming from? . I have had a look at some online resources but none of are using IIS or at least the newer versions of it so its hard to follow.

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.

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.

Below are the steps the error gives to solve it. I have looked through the logs and found it definitely the POST request. I am not sure how to create a tracer though.

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. Create a tracing rule to track failed
requests for this HTTP status code.

I am aware there are other posts similar to this and I have been through a majority of them with no resolution.

Thank you in advance.

  • Solved by removing handler and adding it back in the webconfig file with verb=”*”.

2

Answers


  1. Chosen as BEST ANSWER

    I found the web config file for the handler the error was related to. I then removed it and added back using verb="*". This sets the handler to accept all verbs including POST which I needed.


  2. The error was resolved by adding the following script to web.config

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true">
          <remove name="WebDAVModule"/>
          <!-- add this -->
        </modules>
        <handlers>
          <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
          <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
          <remove name="TRACEVerbHandler" />
          <remove name="OPTIONSVerbHandler" />
          <remove name="WebDAV" />
          <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
          <add name="aspNetCore" path="*" verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
          <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*."  verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS"  type="System.Web.Handlers.TransferRequestHandler" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" responseBufferLimit="0" />
          <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*."  verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS"  modules="IsapiModule" scriptProcessor="%windir%Microsoft.NETFramework64v4.0.30319aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
          <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*."  verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS"  modules="IsapiModule" scriptProcessor="%windir%Microsoft.NETFrameworkv4.0.30319aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
        </handlers>
      </system.webServer>  
    </configuration>
    
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search