Question

This is driving me mad. I've implemented the Web.Routing on a Web Forms application. The application works fine and then inexplicably (at least at the moment) the following error message is thrown:

Object reference not set to an instance of an object. at System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext) at System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) at System.Web.Routing.UrlRoutingModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

This error is intermittent and no amount of navigating around the site recreates the error.

My interpretation of the error is that a request to the server is resulting in a PostResolveRequestCache event with a null httpContext, but I'm not sure how that is possible.

The problem is resolved by restarting the Application Pool.

The application is running on IIS6, because of this, I've added a Wildcard application map to aspnet_isapi.dll with "Verify that file exists" unchecked. This is to enable friendly urls without file extensions, I am however considering changing this as a possible work around. The thinking behind this is, that there is possibly a request being sent to the server which is being picked up the module that shouldn't be.

My implementation has been customised but follows the general guidelines set down by Mr. Haack. Due to the nature of the error, I'm unsure whether any of my code would provide much insight, but I'm obviously willing to do so on request.

Any help would be much appreciated.

Was it helpful?

Solution

Adding custom file extensions was not ideal but has prevented further error messages.

OTHER TIPS

Might be related to the route collection being modified. See other question.

That error is consistent with a collection not being thread-safe in .Net.

Kindly check out my last answer on this similar question

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top