PUT和DELETE的asp.net的WebAPI回报404在Windows 2008服务器IIS 7和7.5 [英] PUT and DELETE returns 404 for asp.net webapi in Windows 2008 Server IIS 7 and 7.5

查看:2029
本文介绍了PUT和DELETE的asp.net的WebAPI回报404在Windows 2008服务器IIS 7和7.5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我碰上的 500 - 内部服务器错误 PUT / DELETE 与Windows 2008服务器IIS。我得到的回应是:

I run into 500 - Internal Server Error when PUT/DELETE with windows 2008 server IIS. The response I get is:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>500 - Internal server error.</title>
<style type="text/css">
<!--
Formatting 
-->
</style>
</head>
<body>
<div id="header"><h1>Server Error</h1></div>
<div id="content">
 <div class="content-container"><fieldset>
  <h2>500 - Internal server error.</h2>
  <h3>There is a problem with the resource you are looking for, and it cannot be displayed.</h3>
 </fieldset></div>
</div>
</body>
</html>

当我检查我的WebAPI的我的自定义日志,我发现电话一直没有连打服务。

When I check my custom logs of my WebAPI I find that the call has not even hit the service.

我以往的经验中得到的 404 - 找不到 PUT 删除和这种行为是在整个的Win7和Win 2008服务器是一致的。对于<一个href=\"http://stackoverflow.com/questions/10099270/asp-net-web-api-returns-404-for-put-only-on-some-servers\">I发现这个修复:

My earlier experience was getting 404 - Not Found for PUT and DELETE and this behavior was consistent across Win7 and Win 2008 Server. For that I found this fix:

我申请的修复和 PUT / DELETE 在WIN2008服务器部署在IIS 7相同的服务时,在Windows 7但在那之后的作品我没有得到400.但是,我得到的500 - 内部服务器错误从IIS甚至之前的东西。

I applied the fix and PUT/DELETE works on windows 7. But after that when deployed the same service on IIS 7 in win2008 server I do not get 400. But I get "500 - Internal Server Error" from IIS or something even before that.

同样的code完美的作品在Windows 7(IIS 7.5)。

The same code works perfectly on windows 7 (IIS 7.5).

对这类问题的解决任何线索?

Any clues on resolution of such issues?

编辑2012年8月29日:

500内部服务器错误的问题是通过使故障跟踪IIS7中检测到。解决方法是该配置。

The issue of 500-Internal Server Error is detected by enabling fault-tracing in IIS7. The fix is this configuration.

<modules runAllManagedModulesForAllRequests="true">
  <remove name="WebDAVModule" />
</modules>
<handlers>
  <remove name="WebDAV" />
</handlers>

基本上,我们需要从模块的处理程序删除WebDAVModule,也删除的WebDAV。但现在,我回到我的老问题 404-未找到。现在,即使有下面的配置我不能让建成后/ DELETE工作:

Basically we need to remove "WebDAVModule" from modules and also remove "WebDAV" from Handlers. But now I am back to my old issue of 404-Not Found. Now even after having the below configuration i cannot get PUT/DELETE to work:

  <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
  <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*" verb="GET,HEAD,POST,DEBUG,PUT,DELETE" type="System.Web.Handlers.TransferRequestHandler" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" />

不寻常的同一Web应用程序完美的作品上的同一系统相同的IIS托管分开(不在默认网站)。所以我怀疑这是由于它过滤PUT / DELETE请求一些家长的网站配置。

Unusually the same web application works perfectly on hosted separately (not under default web site) on the same system same IIS. So I suspect this is due to some parent website configuration which filters PUT/DELETE requests.

在相同的任何想法?

推荐答案

苦苦思索一个非常类似的问题后,我来到这个解决方案:
http://www.iis.net/configreference/system.webserver/security/requestfiltering/verbs

After agonizing over a very similar problem, I came upon this solution: http://www.iis.net/configreference/system.webserver/security/requestfiltering/verbs

使用请求筛选设置,我能够在全球范围内允许PUT和IIS,这解决了我的问题DELETE动词。它结束了我404.6错误的噩梦。 (顺便说一句,我没有安装WebDAV和没有添加动词的ExtensionlessUrlHandler)

Using the Request Filtering settings, I was able to globally allow the PUT and DELETE verbs in IIS, which solved my problem. It ended my nightmare of 404.6 errors. (btw, I did not have webDAV installed and did add the verbs to the ExtensionlessUrlHandler)

希望这个信息能节约一些时间。

Hopefully this info can save someone some time.

这篇关于PUT和DELETE的asp.net的WebAPI回报404在Windows 2008服务器IIS 7和7.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆