locked
Web page takes longer time to load for the first time.

    Question

  • hi

    I am working on a ASP.NET 2.0 application. It is hosted on IIS 6 on Windows 2003 server.

    Few pages have jpeg images (around 50 images and 50 KB each). It takes long time to load the page for the first time. But when i open the same page for the second or third time it is faster.

    why does a  web page take long time to load for the first time?

    Is it cached somewhere when it loads for the first time? Do we have any control over it?

    Thanks
    Ashok

    Friday, April 30, 2010 6:45 PM

Answers

  • Hi Ashok,

    Please read the MSDN article on ASP.NET website precompilation.  The idea is that your source code is compiled into binaries (.dll) before the first user request even occurs.  This way, no compilation is necessary when the first request comes in, which saves time on the server side.

    Regards,
    Chris

    • Marked as answer by Roahn Luo Thursday, May 06, 2010 10:23 AM
    Wednesday, May 05, 2010 12:03 AM
    Moderator

All replies

  • Hello Ashok,

    Thanks for your post!

    As far as I know, the first time when you load your page, it is slow because  your application is being compiled on the fly. To get faster response time, you could use precompilation: http://msdn.microsoft.com/en-us/library/399f057w(VS.85).aspx

    By the way, this forum is for Visual Studio Profiler, please post threads in asp.net forums for more support.

    Best regards


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
    Tuesday, May 04, 2010 5:15 AM
  • Roahn,

              Are you referring to the In-place precompilation ?

    aspnet_compiler -v /<virtual directory name>

    I would like like to know how different is this from building your website ?


    Start by doing what is necessary, then what is possible, and suddenly you are doing the impossible. ~St. Francis of Assisi
    Tuesday, May 04, 2010 6:23 AM
  • Hi Ashok,

    Please read the MSDN article on ASP.NET website precompilation.  The idea is that your source code is compiled into binaries (.dll) before the first user request even occurs.  This way, no compilation is necessary when the first request comes in, which saves time on the server side.

    Regards,
    Chris

    • Marked as answer by Roahn Luo Thursday, May 06, 2010 10:23 AM
    Wednesday, May 05, 2010 12:03 AM
    Moderator