I have a ASP.NET program that works just fine but takes 10 seconds to load the default.aspx page, if I close the browser and quickly reopen the browser and enter the same URL then the page loads almost instantly. I have compiled my code and published the site so it contains dlls so it shouldn't need to compile. This delay is problem for me as my program is designed to get the data as quickly as 开发者_运维技巧possible.
My test.aspx page contains the code below. I have a placed this page within my programs web site so it is using the same web.config.
<%@ Page Title="Test" Language="VB" %>
<html>
<head runat="server"></head>
<body><h2>Hello</h2>
<p><%Response.Write(now())%></p>
</body>
</html>
Can anyone help me remove the startup delay?
Many thanks James
Even if the code is compiled it will still need to be loaded, possibly into a new application domain which might be taking some time.
One solution is to keep the application alive by regularly pinging the website from an external service.
E.g. www.keepaliveforever.com
Change your application pool idle timeout settings in iis
There is no easy answer, you'll probably need to look at a stack trace to figure it out. Observe what code is running and how much time it is taking to execute. Remember, the first time you visit your site your application has to load into memory and various things are happening in the background.
精彩评论