Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS 7.5 and Web API 2 PUT/DELETE Requests

This seems to be a common problem but I've troubleshot all the other techniques people are getting and had no luck, so here goes:

I'm running WebAPI2 along with IIS7.5 on Windows Server 2010. In development my PUT/DELETE requests started working after I added the PUT/DELETE Handlers in HTTP Handlers of IIS. However, once I rolled to prod and applied the same changes I got no such luck. Heres my setup:

WebConfig

Server:

Server

Requests:

 Request URL:http://dev.myserver.com/myapp/api/apps/76a09a7b-0750-4045-a3ce-696df0ff179c
 Request Method:PUT
 Status Code:405 Method Not Allowed

 405 - HTTP verb used to access this page is not allowed.
 The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.

Response Headers:

 Allow:GET, HEAD, OPTIONS, TRACE
 Content-Length:1293
 Content-Type:text/html
 Date:Thu, 21 Nov 2013 15:43:44 GMT
 Server:Microsoft-IIS/7.5
 X-Powered-By:ASP.NET

Obliviously its mad because that verb is not acceptable but the configuration shows that it is. I saw another article talking about removing the WebDav Module from the Modules in IIS, however, once I did that I got a 500 Internal Server Error ( probably because its needed hehe ). Like I said this code is working correctly in dev so I'm not sure what the disconnect is.

like image 743
amcdnl Avatar asked Nov 21 '13 15:11

amcdnl


1 Answers

Seems if I missed the 'HttpHandler' remove of WebDav. The following works:

<system.webServer>
   <modules>
      <remove name="WebDAVModule" />
   </modules>
   <handlers>
      <remove name="WebDAV" />
   </handlers>
</system.webServer>
like image 159
amcdnl Avatar answered Oct 04 '22 02:10

amcdnl