“405 method not allowed” in IIS7.5 for “PUT” method

后端 未结 20 2041
情深已故
情深已故 2020-11-28 02:15

I use WebClient type to upload *.cab files to my server. On the server side, I registered a HTTP handler for *.cab file with the PUT method as below:



        
相关标签:
20条回答
  • 2020-11-28 02:48

    I had the same issues with PUT, PATCH and DELETE but didn't have anything with WebDav installed. Resolution 1 in this article finally helped me: http://support.microsoft.com/kb/942051

    0 讨论(0)
  • 2020-11-28 02:49

    For me this error wouldn't go away and allow PUT methods, whatever i did.. uninstalled webdav, put configuration in web.config to remove webdav from handlers and modules, and set up PUT as an allowed verb on the request filters on iis.. and ensure iis handler mappings handling the request had PUT configured..

    My problem was eventually due to bad installation of ASP.NET 4.5 Extensions. Removed everything related to asp.net from server roles and features. restarted. readded the roles and restarted. everything worked with above config.

    --- The below will make PUT be accepted, but will send it to the wrong handler. --ignore the below

    finally, adding PUT verb as allowed verb on TRACE handler mapping on iis worked.. since i had enabled failed error tracing, and this verb was not allowing the verb.

    last time i had the same problem on another server's IIS, it was due to a missing '/' at the end of the URL since it was using a default handler without using the default document probably and now i realize that.. so check IIS handler mappings if nothing else helps.

    0 讨论(0)
  • 2020-11-28 02:54

    Removing the WebDAV-module should be sufficient. Just change your Web.config:

    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true">
            <remove name="WebDAVModule" />
    
    0 讨论(0)
  • 2020-11-28 03:00

    For whatever reason, marking WebDAVModule as "remove" in my web.config wasn't enough to fix the problem in my case.

    I've found another approach that did solve the problem. If you're in the same boat, try this:

    1. In the IIS Manager, select the application that needs to support PUT.
    2. In the Features View, find WebDAV Authoring Rules. Double-click it, or select Open Feature from the context menu (right-click).
    3. In the Actions pane, find and click on WebDAV Settings....
    4. In the WebDAV Settings, find Request Filtering Behavior, and under that, find Allow Verb Filtering. Set Allow Verb Filtering to False.
    5. In the Actions pane, click Apply.

    This prevents WebDAV from rejecting verbs that it doesn't support, thus allowing a PUT to flow through to your RESTful handler unmolested.

    0 讨论(0)
  • To prevent WebDav from getting enabled at all, remove the following entry from the ApplicationHost.config: <add name="WebDAVModule" />

    The entry is located in the modules section.

    Exact location of the config: C:\Windows\System32\inetsrv\config\applicationHost.config

    0 讨论(0)
  • 2020-11-28 03:01

    I enabled the Failed Request Tracing, and got the following info:

     <EventData>
      <Data Name="ContextId">{00000000-0000-0000-0F00-0080000000FA}</Data>
      <Data Name="ModuleName">WebDAVModule</Data>
      <Data Name="Notification">16</Data>
      <Data Name="HttpStatus">405</Data>
      <Data Name="HttpReason">Method Not Allowed</Data>
      <Data Name="HttpSubStatus">0</Data>
      <Data Name="ErrorCode">0</Data>
      <Data Name="ConfigExceptionInfo"></Data>
     </EventData>
    

    So, I uninstalled the WebDAVModule from my IIS, everything is fine now~

    The IIS tracing feature is very helpful.

    0 讨论(0)
提交回复
热议问题