Reputation: 24624
I'm facing an issue that seems to be related to configuration.
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;
}
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.
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:
Any hints on what to look for would be greatly appreciated!
Upvotes: 1
Views: 1234
Reputation: 10847
One thing you should look into is Server.ClearError(). There are some breaking changes from Win 7 and Server 2008 with the pipeline and errors.
Look at item #21 in the list.
Not sure if this is your problem but it seems like it might be something worth checking.
Upvotes: 0
Reputation: 66641
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;
}
Upvotes: 1
Reputation: 45898
You may need to set up your routing during Application_OnStart() in order to get the routing registered in time for your first request.
http://www.castleproject.org/monorail/documentation/trunk/advanced/routing.html
http://www.kenegozi.com/blog/2009/02/10/monorail-routing-and-the-homepage-routing-rule.aspx
Where do you have it registering routes right now?
Additional suggestions
Here's a couple more things to looks at around CompleteRequest and URL Rewriting:
http://msmvps.com/blogs/luisabreu/archive/2007/10/09/are-you-using-the-new-transferrequest.aspx
http://support.microsoft.com/kb/817036
One suggestion is to try Request.Redirect instead.
Upvotes: 0
Reputation: 3864
Is the application pool on the Server install configured to use the integrated pipeline? It needs to be in order for Server.TransferRequest
to work.
From MSDN Documentation:
This method is used when running with the integrated pipeline mode in IIS 7.0 to allow request processing to be transferred from one resource type to another while executing the target request with the correct request context.
Upvotes: 1