Last post Jul 24, 2008 08:58 PM by My Crystal
Jul 23, 2008 02:01 PM|Kepler|LINK
I'm posting this question in this forum because I've received no answer in the IIS or MVC forums. I'm hoping someone here has some insight.
I'm using IIS7 and ASP.NET MVC Preview 4. Application_BeginRequest gets called many times during a single request. I'm debugging on my local machine, and I can watch in Fiddler or Firebug each of the files getting requested. I can wait between breakpoints
and see that JS files are indeed triggering the breakpoint. It obviously has something to do with the MvcHandler routing all files through the pipeline, but no one else seems to see this behavior (at least no one reading these forums).
I can provide any more information you might need to help diagnose. I'm just looking for ideas because I'm fresh out.
Jul 23, 2008 10:46 PM|Peter Bucher|LINK
The Visual Studio WebDev-server and also IIS7 (In some config) fires Begin_Request on every request, whether its an aspx-page or not.
IIS6 does not in a standard configuration.
You can check the current HttpHandler wheter its a Page or not.
Jul 24, 2008 12:09 AM|My Crystal|LINK
Do you host your web site in VS WebDev Server rather than in IIS?
IN iis, aspx page requests are passed to ASP.NET runtime, other non-asp.net pages resource such as image files are processed directly by iis itself.
In VS WebDev Server, all requests are passed to asp.net runtime.That's why in your case Js files requests trigger HttpApplication's BeginRequest event.
That's all right. when you deploy your website to iis, you will see what you expect.
Jul 24, 2008 01:24 PM|Kepler|LINK
I'm using IIS7. This will be a problem in production as well. After further research, I've discovered that the UrlRoutingModule requires the setting "runAllManagedModulesForAllRequests" to be set to "true" in web.config, and that having the runtime manage
every file request is expected behavior for the UrlRoutingModule to work correctly. I'm not pleased with the fact that there isn't an option to exclude static files from being sent to the .NET runtime, but I've come up with a workaround.
In IIS, I've created an application for my static content directory. This application uses a different application pool than my web app. This app pool does not use the .NET runtime. This seems to be a good solution to this problem.
Jul 24, 2008 08:58 PM|My Crystal|LINK
Sorry for not fully undertanding the environment of your wetsite. I have no experience with IIS7. i am interested in this change from iis 6 to 7. if i find a solution , i will post it.