How can I get OData DELETE to work?
Asked Answered
N

1

15

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.

Nainsook answered 14/7, 2011 at 17:3 Comment(0)
D
36

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>
Darmit answered 14/7, 2011 at 18:23 Comment(4)
Thanks for this. After following instructions from the site at the link you provided, it worked! Run IIS7, select the site, open modules from the features view, remove WebDAV, open handler mappings from features view, remove WebDAV. Restart IIS7.Nainsook
This solved our problem, too. I added the web.config example from the link @Darmit provided, as I think it's better than the manual method.Reversal
This was driving me nuts. I had removed the WebDAVModule but forgot the handler. It was throwing 500 errors until I removed WebDAV too.Ammunition
Just to add to this answer: The LiveStreamingHandler from the IIS Media services might also block the DELETE and PUT verbs.Dollhouse

© 2022 - 2024 — McMap. All rights reserved.