【发布时间】:2012-08-27 04:13:02
【问题描述】:
当PUT/DELETE 使用 Windows 2008 服务器 IIS 时,我遇到 500 - 内部服务器错误。我得到的回应是:
<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 的自定义日志时,我发现调用甚至没有访问服务。
我之前的经验是 PUT 和 DELETE 出现 404 - Not Found,这种行为在 Win7 和 Win 2008 Server 中是一致的。为此I found this fix:
我应用了修复程序,PUT/DELETE 在 windows 7 上工作。但之后在 win2008 服务器的 IIS 7 上部署相同的服务时,我没有得到 400。但我得到 “500 - 内部服务器错误” 来自 IIS 或什至在此之前的东西。
相同的代码在 Windows 7 (IIS 7.5) 上完美运行。
有解决此类问题的线索吗?
2012 年 8 月 29 日编辑:
500-Internal Server Error问题通过在 IIS7 中启用故障跟踪来检测。修复就是这个配置。
<modules runAllManagedModulesForAllRequests="true">
<remove name="WebDAVModule" />
</modules>
<handlers>
<remove name="WebDAV" />
</handlers>
基本上我们需要从模块中删除“WebDAVModule”,并从处理程序中删除“WebDAV”。但现在我又回到了我的旧问题 404-Not Found。现在,即使在进行了以下配置后,我也无法让 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 请求。
有相同的想法吗?
【问题讨论】:
-
请不要以 cmets 的身份发布更正。您可以使用问题底部的 edit 链接,然后修复问题所在。谢谢。
-
这个问题好像没有解决办法
标签: iis-7 asp.net-web-api