Cassini and IISExpress PUT/DELETE Verbs cause 405 Http Code

邮差的信 提交于 2019-12-02 02:33:43

I'm pretty sure it's always been like that, the ASP.NET development server has its limits. I would recommend getting VS2010 SP1 and the IIS Express components through the Platform Web Installer. It will give you the same development experience without the quirks of Cassini.

Put verb should work with IIS Express and for this you need to enable WebDAV (IIS Express installs WebDAV but it does not enable it by default). And also WebDAV does not work with anonymous authentication. So you need to enable WebDAV, disable anonymous authentication and enable Windows Authentication. Follow below steps;

1.Find following three entries in the applicationhost.config file located in user profile(%userprofile%\documents\iisexpress\config\applicationhost.config) and un-comment them (by default they are commented)

<add name="WebDAVModule" image="%IIS_BIN%\webdav.dll" />
<add name="WebDAVModule" />
<add name="WebDAV" path="*" verb="PROPFIND,PROPPATCH,MKCOL,PUT,COPY,DELETE,MOVE,LOCK,UNLOCK" modules="WebDAVModule" resourceType="Unspecified" requireAccess="None" />

Note: Above three elements are not at one place in the configuration file.

2.Add following configuration entry at the end of the applicationhost.config file (Just before '</configuration>' element )

<location path="WebSite1"> 
    <system.webServer>
        <security>
            <authentication>
            <windowsAuthentication enabled="true" useKernelMode="false">
                    <providers>
                        <clear />
                        <add value="Negotiate" />
                        <add value="NTLM" />
                    </providers>
                </windowsAuthentication>
                <anonymousAuthentication enabled="true" />
            </authentication>
        </security>
        <webdav>
            <authoring enabled="true" />
            <authoringRules>
                <add users="*" path="*" access="Read, Write, Source" />
            </authoringRules>
        </webdav>
    </system.webServer>
</location>

Note: In the above config entry replace 'WebSite1' with your site name

3.Restart IIS Express

4.Now try PUT/DELETE request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!