Automatically recompile your site DLL’s when you run IISRESET

I’m probably the last person to work this out, but I’ll be using this trick from now on. One of the issues with performing an IIS Reset is that the next time someone hits the site, it takes 20 or 30 seconds to load. It’s a drag, and on a high-performance site people won’t wait for half a minute to have their pages load.

With Windows 2008 server you have the ability to schedule a task. As part of my normal SharePoint design, I have a scheduled task to recompile all of the SharePoint sites at about 5:00am every morning – SharePoint throws away the site cache at 1:00am or so every day, so it is worth “warming it up” before the office users hit the system… but what I saw this morning made me go and update my build template: You can also set a trigger for the “Site Recompile” scheduled task to execute on an IISRESET event! This means that every time someone runs an IISRESET on the server, the next thing that happens is the sites recompile themselves, minimising the delay for the user.

image

Not that I encourage, endorse or otherwise suggest Administrators would run an IISRESET on a production system, but anything that reduces the outage or delay for users can only be a good thing (and we all know that sometimes SharePoint needs a “kick in the pants” to fix a problem).

Brad

Advertisements

About Brad Saide

I'm a SharePoint consultant. I'm also slowly going bald, seem to have a permanent spare tyre around my waist and enjoy socialising with friends over a beer or 10. The last 2 may possibly be related. Started working with SharePoint when the first version was in limited beta release (participated in the Technology Adoption Program while at Woolworths) and have been committed to the adoption of the technology as a business enabler ever since.
This entry was posted in Uncategorized. Bookmark the permalink.

One Response to Automatically recompile your site DLL’s when you run IISRESET

  1. Eric Xue says:

    Thanks for sharing that, chief.

    I have been there, too. My scenario is a little bit more complicated than that since I have the other applications hosted within the same IIS. Thereby, simple “IISRESET” might kill the other innocent shopping carts or user sessions from the other apps.

    My work-around is to recycle pre-defined application pools by scheduled task, so that it will not bring the casualty to the other applications shared within the same web server.

    Huge fan of your posts!

    Eric

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s