ASP.NET Web API - PUT & DELETE Verbs Not Allowed - IIS 8 -
i upgraded visual studio 2010 visual studio 2012 rc. installer installs iis 8 express visual studio uses default web server.
iis 8 blocking web api requests use put , delete verbs. iis returns 405 error, the requested resource not support http method 'put'.
i know people have issues in past , there several messages on stack overflow. iis 7 express solution uninstall webdav. unfortunately don't see way iis 8.
i've tried editing out webdav sections applicationhost.config hasn't helped. example removed <add name="webdavmodule" image="%iis_bin%\webdav.dll" /> config file.
i've spent far long on this. there must simple way enable put , delete?
okay. got bottom of this. need jump through hoops put , delete verbs working correctly iis8. in fact if install release candidate of vs 2012 , create new web api project you'll find sample put , delete methods return 404 errors out of box.
to use put , delete verbs web api need edit %userprofile%\documents\iisexpress\config\applicationhost.config , add verbs extensionlessurl handler follows:
change line:
<add name="extensionlessurl-integrated-4.0" path="*." verb="get,head,post,debug" type="system.web.handlers.transferrequesthandler" precondition="integratedmode,runtimeversionv4.0" /> to:
<add name="extensionlessurl-integrated-4.0" path="*." verb="get,head,post,debug,put,delete" type="system.web.handlers.transferrequesthandler" precondition="integratedmode,runtimeversionv4.0" /> in addition above should ensure webdav not interfering requests. can done commenting out following lines applicationhost.config.
<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" /> also aware default web api convention method name should same invoked http verb. example if you're sending http delete request method, default, should named delete.
Comments
Post a Comment