获取.net来处理IIS7中的所有请求 [英] Get .net to handle all requests in IIS7

查看:509
本文介绍了获取.net来处理IIS7中的所有请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I had an application that was running on IIS 6. All requests went through aspnet_isapi.dll. This was achieved via a wildcard application mapping (which did not verify the file existed).

我已将所述应用程序复制到运行IIS7的计算机上,并希望得到它再次工作。

I have copied said application to a machine running IIS7, and would like to get it working again.

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

In the application, any request with an extension of .aspx (or .ashx) are handled in the normal way. Other requests with different extensions (such as .html and .xml) are handled by a custom http module. Some requests have no extension, and are dynamically redirect to a file with an extension (e.g. visiting …/item/1 might redirect to …/item/1.html or …/item/1.xml, depending on values in the accept header).

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

The new location probably does not exist, but a response is generated dynamically.

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

Currently, the application pool is in "classic" mode, and is using .NET v4.0 (it was previously using .NET 3.5, but that doesn’t seem to be related to the problem). The custom http module is set only in the web.config.

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

The redirect (from …/item/1 to …/item/1.html) seems to work, which suggests that extension less requests are indeed being processed by the application (that redirect is written in the application itself). I think that means that the custom module is working.

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

Requests with extensions (.html, .xml etc) are failing however. The error I get is:

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

I have tried: Adding a wildcard script mapping that mapped * to aspnet_isapi.dll Tried adding a specific mapping for *.html to aspnet_isapi.dll

这些仍然会产生相同的错误消息,似乎仍然会转到处理程序StaticFile。

These still result in the same error message, and still seem to go to the handler "StaticFile".

我尝试修改StaticFile以便它使用aspnet_isapi.dll可执行文件,这会导致新的错误:

I tried modifying "StaticFile" so that it uses the aspnet_isapi.dll executable, and this results in a new error:

HTTP Error 404.4 - Not Found
The resource you are looking for does not have a handler associated with it.
Handler: Not yet determined

任何帮助将不胜感激。

推荐答案

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

Set application pool in integrated mode and set that all request run all managed modules

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

这篇关于获取.net来处理IIS7中的所有请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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