سؤال

Now this this could be a simple question, but I am a little confused.

I published my MVC3 C# .NET web application to a IIS folder. I have selected the precompile options and unchecked the "allow site to be updateable" to ensure Views are compiled, and they are, to ".compiled" files in bin ie:

_createoredit.cshtml.1c32bb75.compiled

The "cs" files are compiled into the main project dll ie.

myApp.dll

On first call, the page can take 30 - 60 secs to load then < 1 sec

If I refresh the app pool the page then takes 30-60 secs again.

My current understanding is that this time delay is caused by the jitter compiling the byte code in the dll into binary code ??

I had hoped to significantly increase response time post app pool refresh by precompiling the Views. However not so, but perhaps this is due to the fact the my project file is in byte code, and that I need to do something more to it?

I do understand that you can keep web apps warm by repinging the site, but the reality is that app pools do get refreshed for strange reasons. Also I am using Azure. So I would really like to use deployed units of code that will run as quickly as possible after a refresh.

Many thanks in advance for any help.

EDIT

Having precompiled the Views and deployed to Azure Websites using Shared or Standard instances, I still get the initial load lag, instigated by an AppPool refresh which I deliberately cause by a resave of the Web.config. To be honest I am not seeing any significant benefit in precompiling the Views, as I still get a time penalty when .NET seems to further compile the ".compiled" views on first load.

EDIT2

More information in reference to @Yishal's post.

I am using Basic on dev and standard on test. I have enabled "Always on" which is in effect an autoping. I also have "Uptime-robot" autopinging. I have also tested a seperate shared site with all Views precompiled. The autopinging helps to keep the app pool warm. However if the app pool refreshes ie via web.config resave (for testing) then one get the long initial wait again. Can be up to a minute, then < 1 sec for same page. The only thought I have is that it is taking ~ 60 secs for the project.dll(.net p-code) to be compiled down to binary and be held in RAM.

هل كانت مفيدة؟

المحلول

If you are using the Web sites free tier, this is expected. If you are not please let me know, and we can look more into it.

Also note that pre-compiling view does not assist in start-up time at all for your scenario, particularly if you try to his a single page. This single page will get compiled on the fly and the cost for that is rather small.

نصائح أخرى

When you pre-compile an application and then deploy it on the server application pool will be restarted and take a little bit to reload itself.After that with new featur in aspnet it still sleeping untile next request which will be show in few millisecond.It is a new feature of iis 8.

however if you're not on iis 8 when application pool has been restarted take some time to complete all the hosting process and to unload, re-load and recompile the site in order to serve it in next request.It is normal behavior.You can do it thosand times and it will always the same :)

Hope it help

You might want to take a look at this post on IIS 8's Application Initialization Module on Azure: http://fabriccontroller.net/blog/posts/iis-8-0-application-initialization-module-in-a-windows-azure-web-role/ (originally linked from: Does Windows Azure support the Application Warm-Up module or something similar?).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top