简体   繁体   中英

HTTPModule for static files sometimes fails to run on IIS 6

I have and HTTP module that cleans, compresses and minifies CSS, JS, and HTML files based on their content type header. It works great in my staging environment and localhost (ISS7, classic pipeline mode). On IIS 6 (production), it is not reliable. Sporadically, this static files stop being processed by asp.net and appear to be reverting to the default IIS handler. If I touch the web.config or do an IISRESET it will start working correctly again, for a time. Even when the module gets into this "wacky state", .aspx files are still running through the module as expected. So, I am fairly certain that the module is not the issue, and that what we are looking at is an IIS problem.

  1. I have HTML, JS and CSS files mapped in IIS 6 to be processed by aspnet_isapi.dll for all verbs.
  2. In my web.config, I have set these static files to be handled by System.Web.StaticFileHandler in the handlers section also for all verbs.
  3. The HTTP Module is wired up in the web.config as well.

Any ideas? I'd like to avoid upgrading my production web server to IIS 7 for the time being!

I would say with pretty high confidence that the problem lies in your HttpModule. Maybe the problem could be a threading issue. The HttpModule is only instantiated once for all requests, so if you store data in member variables in the class, you will have a problem as multiple threads will access the same data at the same time.

By the way, I think I would suggest an alternate solution to your problem. Create a build script, using eg MSBuild, and let the build script compress the files.

A big difference between development and production is volume of traffic.

Volume can highlight concurrency issues not hit upon in low traffic development testing.

Are you sure your code is free of threading issues etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM