6

我似乎无法OPTIONS在我的 IIS6 托管 ASP.NET 应用程序中接收 HTTP 请求。Global.asax我正在使用我的方法中的调试断点(和文件日志)对其进行测试Application_BeginRequest。断点永远不会被命中,并且客户端会收到 HTTP 403 Forbidden,我直接从 IIS6 假设(GETs 和POSTs 可以正常工作)。

我在 中尝试了几件事web.config,包括在<system.webServer><handlers><system.web><httpHandlers>部分中添加以下行。

<add name="OptionsHandler" verb="OPTIONS" path="*" type="System.Web.DefaultHttpHandler"/>

我也玩过<system.webServer><security><requestFiltering><verbs>设置和allowUnlisted="true"<add verb="OPTIONS" allowed="true"/>

此外,我没有使用 URLScan 或任何其他可能拦截呼叫的工具。如果您对 IISLogs 感兴趣:

2011-07-11 20:26:05 W3SVC1215124377 127.0.0.1 OPTIONS /test.aspx - 80 - 127.0.0.1 Mozilla/5.0+(Windows+NT+5.2;+rv:5.0)+Gecko/20100101+Firefox/5.0 403 1 0

有没有办法OPTIONS在 ASP.NET 应用程序中接收请求?

4

1 回答 1

5

对于 IIS6,您必须在管理控制台中显式启用 OPTIONS 动词,并且您还需要将其映射为由 ASP .NET 处理。只有这样,您才能在其中注册您的处理程序<system.web>并让 ASP .NET 处理请求。

(注意,<system.webServer>设置仅适用于 IIS7)。

于 2011-07-11T20:51:40.293 回答