gpt4 book ai didi

iis - 获取 .net 以处理 IIS7 中的所有请求

转载 作者:行者123 更新时间:2023-12-04 21:21:50 25 4
gpt4 key购买 nike

我有一个在 IIS 6 上运行的应用程序。所有请求都通过 aspnet_isapi.dll。这是通过通配符应用程序映射(未验证文件是否存在)实现的。

我已将所述应用程序复制到运行 IIS7 的机器上,并希望让它再次运行。

在应用程序中,任何扩展名为 .aspx(或 .ashx)的请求都以正常方式处理。具有不同扩展名的其他请求(例如 .html 和 .xml)由自定义 http 模块处理。一些请求没有扩展名,并且动态重定向到带有扩展名的文件(例如,访问…/item/1 可能会重定向到…/item/1.html 或…/item/1.xml,具体取决于接受 header 中的值)。

新位置可能不存在,但会动态生成响应。

目前,应用程序池处于“经典”模式,并且使用的是 .NET v4.0(之前使用的是 .NET 3.5,但这似乎与问题无关)。自定义 http 模块仅在 web.config 中设置。

重定向(从 .../item/1 到 .../item/1.html)似乎有效,这表明应用程序确实正在处理扩展较少的请求(该重定向是在应用程序本身中编写的)。我认为这意味着自定义模块正在工作。

但是,带有扩展名(.html、.xml 等)的请求失败了。我得到的错误是:

HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

Module: IIS Web Core
Notification: MapRequestHandler
Handler: StaticFile
Error Code: 0x80070002

我试过了:
添加将 * 映射到 aspnet_isapi.dll 的通配符脚本映射
尝试将 *.html 的特定映射添加到 aspnet_isapi.dll

这些仍然会导致相同的错误消息,并且似乎仍然会转到处理程序“StaticFile”。

我尝试修改“StaticFile”,使其使用 aspnet_isapi.dll 可执行文件,这会导致一个新错误:
HTTP Error 404.4 - Not Found
The resource you are looking for does not have a handler associated with it.
Handler: Not yet determined

任何帮助将不胜感激。

最佳答案

将应用程序池设置为集成模式并设置所有请求运行所有托管模块

<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
...
</modules>
...
</system.webServer>

关于iis - 获取 .net 以处理 IIS7 中的所有请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9925346/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com