views:

64

answers:

4

I have 2 sites on IIS, one is the live site and the other is a site that is only started when there is maintenance being carried out on the live site.

In a deployment scenario I STOP the live site and the START the maintenance site so that users receive a friendly message advising of the upgrade.

The only issue I have is when I start up the live site it obviously has to JIT and this can take up to 3 minutes.

Is there anyway to have this JIT before I unleash it to the users?

EDIT: Just to clarify, this site is a CMS, so the marked answer below works for me due to only having 1 page to compile.

Thanks

+2  A: 

The only way I can think of is to change the bindings on the stopped site, start it, run a page, apply the bindings, turn off maintenance site and start the live site.

Marko
I'm going to give this a go and mark as answer if it works, thanks. Edit: Not that I'm doubting whether it works or not ;-)
Mantorok
This will not JIT every page on the site. Each page will be JIT'ed the first time it is navigated to. It would work if you ran every page on the site.
Daniel Dyson
This is a CMS, so there is only one page.
Mantorok
Ok. In that case you should be able to get away with this approach. However, if you mark this as the correct answer, please make it clear in your question that this is a one page site and that the solution might not be applicable to other sites.
Daniel Dyson
@Daniel, ok, I've done that.
Mantorok
A: 

I don't believe there is anything out of the box that would do this. In fact, the IIS7 warmup module that they just released a few months ago just basically crawls and hits up your pages once to "warm them up".

If I were you, I would write a little program that makes WebRequests of each page. There may be a third-party tool out there which would do this quickly and easily, though, so it's still a good question...

Dave Markle
A: 

you can use the aspnet_compiler.exe to precompile your web site. You can use it from the command line or call it from a nant script.

[aspnet_compiler][1]

[1]: http://msdn.microsoft.com/en-us/library/ms229863%28VS.80%29.aspx />

skyfoot
Even if you precompile, the JIT compiler has to step in, create native code, and cache it on the server
Ed B
MSBuild uses the aspnet_compiler.exe to compile every time you compile an ASP.NET website, so this will have no effect whatsoever.
Daniel Dyson
Thanks for clarifying what I thought guys, this project is already pre-compiled in that respect, I didn't think this was going to make any difference.
Mantorok
+4  A: 

Looks like you will need to use NGen...

The Native Image Generator (Ngen.exe) is a tool that improves the performance of managed applications. Ngen.exe creates native images, which are files containing compiled processor-specific machine code, and installs them into the native image cache on the local computer. The runtime can use native images from the cache instead using the just-in-time (JIT) compiler to compile the original assembly.

Precompile the website for deployment, using fixed names, deploy the solution to the server, and then ngen all assemblies in bin

MSDN article on NGen.

I should add that by pre-generating the native code like this you may lose some optimizations that the runtime performs based on the current system performance such as memory and register use. This might even result in the site running slower than if it were JIT'ed. Microsoft recommends that you try both the NGen and JIT approaches on the target platform under conditions approximating those found under normal use.

Daniel Dyson