AspNet routing problem with IIS7 and integrated pipeline
I have an asp.net site that uses asp.net routing to dynamically create some reports. I mapped the extension.zip to asp.net ISApi, then with routing I map url
|
|
everything works perfectly, until I move this site to IIS7 and try to use it with integrated pipeline mode. When I browse to a valid report url I got this error.
It seems that my request must be satisfied by UrlRouting.axd handler… very strange. If I attach a debugger to worker process I can verify that routing is ok, my IRouteHandler is called correctly, it creates the handler that will be used to satisfy the request, but the handler was never called. After a deep search on the internet I did not find anything, except this link.
It seems that for a reason that I do not know, iis7 in integrated mode want to use UrlRouting.axd when routing is used, the solution is adding this line to the <handlers> section of config file
|
|
The solution was to add an handler that maps, in integrated mode, the UrlRouting.axd to the HttpForbiddenHandler, now everything work perfectly.
Then I had another absurd problem when I moved everything on production server, the routing works, but it throws an exception my handler because httpContext.Current.Session is null. This is very strange, but even stranger is the solution, simply remove and readd session module in <Modules>
|
|
This sounds absurd to me, but the real solution is another, putting runAllManagedModulesForAllRequests into <modules> declaration.
|
|
You can check some other details here in ScottGu’s blog.
Alk.
Tags: Asp.Net Routing