我遇到500内部服务器错误 when PUT/DELETE
与 Windows 2008 服务器 IIS。我得到的回应是:
<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 的自定义日志时,我发现调用甚至没有命中服务。
我早期的经历是404 - 未找到 for PUT
and DELETE
这种行为在 Win7 和 Win 2008 Server 中是一致的。为了那个原因我找到了这个修复:
我应用了修复程序并PUT/DELETE
适用于 Windows 7。但是之后,当在 win2008 服务器中的 IIS 7 上部署相同的服务时,我没有得到 400。但我得到“500内部服务器错误”来自 IIS 或者更早的东西。
相同的代码在 Windows 7 (IIS 7.5) 上完美运行。
有关解决此类问题的任何线索吗?
2012 年 8 月 29 日编辑:
的问题500内部服务器错误通过在 IIS7 中启用故障跟踪来检测。修复就是这个配置。
<modules runAllManagedModulesForAllRequests="true">
<remove name="WebDAVModule" />
</modules>
<handlers>
<remove name="WebDAV" />
</handlers>
基本上,我们需要从模块中删除“WebDAVModule”,并从处理程序中删除“WebDAV”。但现在我又回到了我的老问题404-未找到。现在,即使进行了以下配置,我也无法让 PUT/DELETE 工作:
<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 请求造成的。
有什么相同的想法吗?