本文介绍了Server.TransferRequest返回特定服务器上的空白页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我面对这似乎是与配置的问题。

I'm facing an issue that seems to be related to configuration.

我有一个基于单轨,我们利用从单轨路由功能的web应用。在申请后的第一个请求开始,路由未初始化。为了规避这个问题,我有Application_OnError()以下的code:

I have a webapplication based on MonoRail, where we utilize the routing feature from MonoRail. On the first request after the application has started, the routing isn't initialized. To circumvent this, I have the following code in Application_OnError():

public virtual void Application_OnError()
{
    if ( // identified as routing error )
    Server.TransferRequest( Context.Request.RawUrl, false );
    return;
}

问题beeing,我们的开发服务器(运行服务器2008 R2,与IIS 7.5和.NET 3.5)上返回,而不头一个空白页,但我的工作站(运行WIN7,IIS 7.5和.NET 3.5)它的工作原理罚款。

Problem beeing that on our development server (which runs server 2008 R2, with IIS 7.5 and .NET 3.5) returns a blank page without headers, but on my workstation (which runs win7, IIS 7.5 and .NET 3.5) it works fine.

可能是什么这个原因?如果Application_OnError(在code)抛出一个异常,这将是预期的输出?

What could be the cause of this? If the code in Application_OnError() throws an exception, what would be the expected output?

我已经验证了以下内容:

I have verified the following:


  • 的访问日志显示一个条目,我不知道是否成功时调用TransferRequest将显示为第二个条目

  • 应用程序做一些实际的工作,根据我的内部记录,并因为后续请求不会死完美的作品(因为路由将被激活)

在寻找什么将是极大的AP preciated任何提示!

Any hints on what to look for would be greatly appreciated!

推荐答案

我认为有一抛错误,但你看不到它,因为你的网页是所有准备在其他一些错误并需要捕获这种方式即可。之后,你可以找到真正的问题,因为从我TransferRequest检查可以有很多认为给错误。

I think that there is a throw error, but you do not see it because your page is all ready on some other error and you need to capture it that way. After that you can find the real problem, because from my checks in TransferRequest can be many thinks that give error.

public virtual void Application_OnError()
{
    if ( identified as routing error )
    {
        try
        {
            Server.TransferRequest( Context.Request.RawUrl, false );
        }
        catch(Exception x)
        {
            LogTheError(x.ToString());
        }
    }

    return;
}

这篇关于Server.TransferRequest返回特定服务器上的空白页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-03 20:32