views:

70

answers:

4

Hi,

I switched from php to asp.net for a certain project, and i've created a web application and everything went smoothly.

I have one question though....when I navigate to my website the very first time, it loads for about 8-10 seconds. I assume the code is compiling in this time. If i go back to the site, it will load very quick. However if I got back to it the next day, it will compile again.

I was wondering can anyone elaborate on what is going on? I understand it needs to compile once, but why does it do so again the next day? Is there anyway I can avoid this?

Thanks for any advice/insight,

Andrew

A: 

Did you reboot your machine? Every time IIS is restarted it will need to compile your site again. Otherwise it's probably not recompiling, it's hitting the disk because the code isn't in the cache.

This shouldn't be an issue when you've deployed your app, only when you have a development setup.

Nate C-K
An 8 second seek time for a file on the disk is quite unlikely.
voyager
You've obviously never used my dev machine.
Nate C-K
To clarify, I don't mean just the disk seek time. It's the overall process of swapping around pages in VM that causes slowness. But I suspect that the other posters are right and IIS is being restarted for some reason.
Nate C-K
A: 

You can precompile your app by deploying from VS Professional, or using the command line asp.net compiler.

recursive
+1  A: 

why does it do so again the next day?

Because of the ASP.NET Application gets restarted.

Possible reasons:

  • IIS application pool is configured to recycle the working process.
  • Other application touches (modifies or at least just rewrites) web.config.

Is there anyway I can avoid this?

Yes.

  1. Disable IIS application pool recycling.
  2. Make sure web.config is not touched by any other process. These are usually anti-vurus programs, but pretty rare case. So the 1st option is 99.9% is the cause.
  3. Precompile the ASP.NET application. This and this pages explain how.
Dmytrii Nagirniak
Thanks, recycling was on, so I turned it off. The precompiling links were also useful.
Andrew
A: 

Take a look at the ASP.NET Application Life Cycle:

IIS 5 & 6 - http://msdn.microsoft.com/en-us/library/ms178473.aspx

IIS 7 - http://msdn.microsoft.com/en-us/library/bb470252.aspx

Andy May