"405 method not allowed" in IIS7.5 for "PUT" method Ask Question

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:

 <add name="ResultHandler" path="*.cab" verb="PUT" type="FileUploadApplication.ResultHandler" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />

But I always get a "405 method not allowed" error. The response said the allowed methods are as below:

Headers = {Allow: GET, HEAD, OPTIONS, TRACE
Content-Length: 1293
Content-Type: text/html
Date: Fri, 27 May 2011 02:08:18 GMT
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET}

Even if I explicitly allow the PUT method in the IIS Request Filtering for my web application, the same error still occurs.

I suspect this is a IIS related issue. I'm hoping someone could shed some light on this for me.

ベストアンサー1

Often this error is caused by the WebDAV module that try to handle this kind of requests. An easy solution is to remove it from modules and from handlers of the system.webServer section just inside your web.config file. Here a configuration example:

<system.webServer>
    <modules>
        <remove name="WebDAVModule" />
    </modules>
    <handlers>
        <remove name="WebDAV" />
    </handlers>
</system.webServer>

おすすめ記事