Global.asax中没有触发在IIS7 .aspx页 [英] Global.asax not firing for .aspx pages in IIS7

查看:500
本文介绍了Global.asax中没有触发在IIS7 .aspx页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们运行一个链接重定向服务,它可以处理各种格式扔给​​它的链接。其中这些格式是目标URL追加到链接的末尾,例如:

We run a link redirection service which can handle links thrown at it in various formats. One of these formats is to append the destination URL to the end of the link, for example

HTTP://url.fwd/abcd/http: //www.mydomain.com/page.aspx

这是工作在Windows Server 2003 / IIS6框在过去两年,但现在我们正试图移动到Windows Server 2008 / IIS7设置和其不再工作。

This was working on a Windows Server 2003 / IIS6 box for the last two years, but now we're trying to move to a Windows Server 2008 / IIS7 setup and its not working anymore.

我读过有关网址中包含冒号的问题,但它不会影响'的.aspx'没有不散的页面。例如,

I've read about the problem with colons in the URL but it doesn't affect pages not ending in '.aspx'. For instance,

HTTP://url.fwd/abcd/http: //www.mydomain.com/page.php

会重定向罚款。

HTTP://url.fwd/abcd/http// www.mydomain.com/page.aspx

也能正常工作(注意,没有第二个冒号)。尽管是错误的URL,它不被我们的URL转发系统,它使用一个自定义的404页处理。在旧系统中,我们也有类似的问题,所以一个方法是写在Global.asax中>的Application_Error专门处理'的.aspx'的情况下,它工作得很好。

also works fine (note the lack of a second colon). Despite being the wrong URL, it does get handled by our URL forwarding system, which uses a custom 404 page. On the old system, we had a similar problem, so a method was written in Global.asax > Application_Error specifically to handle the '.aspx' case, and it worked fine.

在我们的新服务器上,的Application_Error永远不会在Global.asax中抛出。相反,我得到一个System.NotSupportedException - 指定路径的格式不被支持。这是System.NotSupportedException我们在Global.asax页面处理的确切情况,因此它肯定不会被解雇。

On our new server, the Application_Error never gets thrown in Global.asax. Instead, I get a System.NotSupportedException - "The given path's format is not supported". This System.NotSupportedException is the exact case we handle in the Global.asax page, so it's definitely not being fired.

我已经改变了在几个论坛的帖子显示的注册表项,
HKEY_LOCAL_MACHINE \\ SOFTWARE \\微软\\ ASP.NET VerificationCompatibility = 1
HKEY_LOCAL_MACHINE \\系统\\ CurrentControlSet \\服务\\ HTTP |参数AllowRestrictedChars = 1

I've changed the registry keys indicated in several forum posts, HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET VerificationCompatibility=1 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\HTTP|Parameters AllowRestrictedChars=1

我试着改变处理程序映射设置的.aspx。

I've tried changing the Handler Mappings settings for .aspx.

我已经尝试设置应用程序池使用经典模式,而不是集成的,但这会导致完全不同的错误的静态内容,如图像和CSS不显示在所有。我检查了静态内容在Windows功能启用,它是。
在经典模式中,'的.aspx的要求抛出两个坏请求错误绝对没有任何信息。错误页面,我得到的code是字面上

I've tried setting the App pool to use classic mode instead of integrated, but this causes a completely different error where static content such as images and CSS do not display at all. I've checked that static content is enabled in the windows features, and it is. Under classic mode, the '.aspx' request throws two Bad Request errors with absolutely no information whatsoever. The code of the error page I get is literally

无效请求< HTML和GT;<身体GT;错误的请求和LT; /身体GT;< / HTML>

Bad Request<html><body>Bad Request</body></html>

更新:我已经改变了静态文件处理程序映射到在本页面发现形式
http://improve.dk /博客/ 2006/12/11 /制作-URL重写-上IIS7工作样IIS6
然而,正如作者正确地指出,这是一个黑客,而不是IIS7下做事的正​​确方法。它也只修复了经典模式静态文件的问题。 '的.aspx页面仍然扔在经典模式中的错误。

UPDATE: I've changed the static file Handler Mapping to the form found in this page http://improve.dk/blog/2006/12/11/making-url-rewriting-on-iis7-work-like-iis6 However, as the author rightly points out, this is a hack and not the correct way of doing things under IIS7. It also only fixes the static file problem in classic mode. '.aspx' pages still throw an error under classic mode.

任何想法或投入将大大此时pciated AP $ P $。

Any thoughts or input would be greatly appreciated at this point.

推荐答案

IIS 7的解决方案

IIS 7 Solution

在IIS 7中简单的办法是在你的web.config文件中添加一个设置来告诉IIS处理通过您的Global.asax事件的所有请求。只需添加或更改本节你的web.config,使请求:

The easy solution in IIS 7 is to add a setting in your web.config file to tell IIS to process all requests through your Global.asax events. Just add or change this section in your web.config to enable requests:


  

请参阅
<一href=\"http://www.devtoolshed.com/globalasax-events-iis-6-and-iis-7-static-resources\">http://www.devtoolshed.com/globalasax-events-iis-6-and-iis-7-static-resources

这篇关于Global.asax中没有触发在IIS7 .aspx页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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