views:

215

answers:

3

What can I do to ensure that when an application/app pool restart is triggered, that the application comes back online as fast as possible?

Better yet, is there a way to prevent the application restart when the usual triggers occur? Like modifying the web.config, global.asax, or machine.config?

A: 

Mainly, we use website projects, so I assume that switching to web application projects would speed this up since all of the code files are pre-compiled into a .dll.

When using website projects, I would think that moving App_Code files into an external class library would also speed things up since the code would be pre-compiled.

SkippyFire
+1  A: 

Yes, moving to web apps will speed up the restart process. Another thing to do would be to make your global.asax as clean as absolutely possible.

Even with web apps, the site will do a restart if any of those config files are modified or if the assemblies in your bin directory change. You can't stop this.

Restart times should be pretty quick at around 2 to 3 seconds. However, I've seen some pretty complicated global.asax files which set up some domain level data that took up to 20 seconds. Of course, they were willing to pay that price because it reduced some of their normal page load times from 3 seconds to .1 second.

Chris Lively
+1  A: 

There will be an "auto-start" feature in ASP.NET 4.0 (Scott Guthrie talks about it), but that won't help you now.

Please be sure that the Application Pool your website/application is running in, won't go to "sleep" automatically. A default AppPool is set to shut down after 20 minutes inactivty. As i recall this doesn't make the website rebuild, but makes the first request notably slower.

Small note, a website project can also be build, so your App_Code will be empty and your bin folder will contain a bunch of .dll's (just use Build > Build Website). This definitely will makes the first request to your site faster. I don't think a website application will kick in faster than a precompiled website project, but it is just easier to manage.

Richard
Yeah I did see that in the new feature set for 4.0. However, I don't know if that would speed things up necessarily; it would just make sure that the app is ready to go. But that actual startup time would probably be the same. About the app pool shut down... I'm not sure if I want to remove that. I would still like to have the app shutdown if no one is using it because we have multiple sites running on the same server. But I get your point. Are you sure that a website project can be "built" like that? Do you mean published?
SkippyFire