IIS 7.5和Web API 2 PUT/DELETE请求

amc*_*dnl 5 iis iis-7.5 asp.net-web-api

这似乎是一个常见的问题,但我已经麻烦了所有其他技术,人们没有运气,所以这里有:

我在Windows Server 2010上运行WebAPI2和IIS7.5.在开发中,我在IIS的HTTP处理程序中添加了PUT/DELETE处理程序后,我的PUT/DELETE请求开始工作.然而,一旦我开始生产并应用相同的变化,我就没有运气了.继承人我的设置:

WebConfig

服务器:

服务器

要求:

 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.
Run Code Online (Sandbox Code Playgroud)

响应标题:

 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
Run Code Online (Sandbox Code Playgroud)

不知道它是疯了,因为动词是不可接受的,但配置表明它是.我看到另一篇文章谈论从IIS中的模块中删除WebDav模块,然而,一旦我这样做,我得到了500内部服务器错误(可能是因为它需要hehe).就像我说这个代码在dev中正常工作所以我不确定断开连接是什么.

amc*_*dnl 19

似乎我错过了'HttpHandler'删除WebDav.以下作品:

<system.webServer>
   <modules>
      <remove name="WebDAVModule" />
   </modules>
   <handlers>
      <remove name="WebDAV" />
   </handlers>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)

  • 奇迹般有效。救了我的尾巴。:) (2认同)