tags:

views:

62

answers:

3

Hi all

I've got a web app solution containing a class library project.

Whenever I rebuild the class library and then refresh the page, it takes ages the first time, and is then quick again subsequently.

It's almost as if the newly rebuilt dll is having to 'bed in' to the app.

Can anyone tell me what's really going on behind the scenes?

Thanks

David

+1  A: 

Because the asp.net website is compiling the website the first time it runs, you can precompile the website to avoid this behavior.

Or you can make a website project

Amr ElGarhy
+2  A: 

If you're talking about Web Site (not Web Application) ASP.NET needs to recompile all the assemblies behind the scene. And this requires restarting the app domain.

UserControl
+3  A: 

It's almost as if the newly rebuilt dll is having to 'bed in' to the app.

That's exactly it. The first time ASP.NET actually loads up an assembly is when it gets JITted. You can move this startup time from the first time the application is used to the time it gets built by including something along these lines as a post-build event in the project:

aspnet_compiler.exe -p $(ProjectDir) -v / 

Check the docs for aspnet_compiler for background info and more options.

AakashM
Thanks for the detailed answer!
David