How can I get OData DELETE to work?

Stephen Oberauer picture Stephen Oberauer · Jul 14, 2011 · Viewed 8.4k times · Source

I've created an OData service (WCF Data Service), and a consumer to test it.

Previously, when I attempted to delete, I got the WebDAV 405 error message, "Method Not Allowed".

So I googled and found:

http://nikhilthaker86.wordpress.com/2010/03/27/issue-hosting-restful-services-on-iis-7/

I followed the instructions and removed the WebDav module from my website (service) in IIS 7.

Now I get this error message instead:

"HTTP Error 500.21 - Internal Server Error

Handler "WebDAV" has a bad module "WebDAVModule" in its module list

Module: IIS Web Core Notification: ExecuteRequestHandler"

If you have a solution that will make this problem go away, I would really appreciate it... otherwise, if you're an IIS guru, and you're thinking "This guy has no idea what he's doing", please point me in the direction of some useful online reading material.

Thanks in advance.

Answer

TRayburn picture TRayburn · Jul 14, 2011

The WebDAV module will block both the DELETE and PUT (update) verbs for IIS. You can either uninstall WebDAV (recommended) or simply remove it from the Handlers of the site. More details can be found here: http://forums.iis.net/t/1166025.aspx

One way to do this is to add the following remove lines to your site's web.config:

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