ASP.Net application runs slow at first time

血红的双手。 提交于 2019-12-04 07:24:00

In addition to what sky said, you could run a "warmup script" as the last step of your deployment process. Although this won't speed up the time needed for the first compilation, using such a script would at least prevent users seeing a slow startup. Have a look here for an example of such a script: http://programmerramblings.blogspot.com/2008/09/aspnet-site-warmup.html

Another reason why the very first request to your application is slow could be that IIS has to start the asp.net worker process during the very first request. This should however not affect first requests to other pages.

publish the website, which precompiles, as opposed to copying it.

The behavior you are experiencing is normal.

I had the same in ruby on rails application with passenger but I found a nice tool ( http://www.wekkars.com ) that just prevents the webserver to go to sleep.

You can also use Auto start application feature which is available for .net framework 4 web applications. For more info visit here.

VBscript + Dos Batch file... run every 1 hr 


Dim strNewTime , strSiteName
strNewTime = Now() 
strNewTime = Replace(strNewTime, "/","")
strNewTime = Replace(strNewTime, " ","")
strNewTime = Replace(strNewTime, ":","") 

strSiteName = "https://www.yoursite.com/userlogin.aspx?dummytime=" + strNewTime

Dim oXMLHTTP
Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.6.0")       

oXMLHTTP.Open "GET", strSiteName, False
oXMLHTTP.Send

If oXMLHTTP.Status = 200 Then
'  working
ELSE
    CALL SendEmail("!!! www - web site is NOT working... " + strSiteName + " *** ") 
End If

Set oXMLHTTP = Nothing 

There will always be a slight delay on first load of any .NET application due to CLR component in .NET Framework platform. Because JIT(Just in Time) residing inside CLR (Runtime Environment for ASP.NET) converts Intermediate Language (IL) to native machine code, it will always take little bit longer on the first execution for the .net applications.

A detailed video on this specific issue can be viewed on:

https://www.youtube.com/watch?v=ruf4U9_Rbss&index=1&list=PL8598C97BA1D871C1

Hope it helps.

For asp.net applications running on IIS 7.0 and lesser versions, writing a warmup program or script is a best way to prevent the app pool idle timeouts. This warmup trigger can be setup from the same application or from the external websites or programs. You can find different ways to achieve the same in this article

There is no way around this. You will always get a slight delay on first load as the site compiles.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!