JamesP
JamesP

Reputation: 13

ASP.NET site takes 10 seconds to load basic Hello World page but is instant on second load

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

Upvotes: 1

Views: 1295

Answers (3)

brian brinley
brian brinley

Reputation: 2364

Change your application pool idle timeout settings in iis

Upvotes: 0

James Gaunt
James Gaunt

Reputation: 14783

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

Upvotes: 3

Zachary
Zachary

Reputation: 6532

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.

Upvotes: 0

Related Questions