Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET MVC 3 Site Loading Is Extremely Slow
    primarykey
    data
    text
    <p>I really don't know where to begin with this question, but the site I'm working on at times has some really slow page loads. Especially after doing a build, but not always. I usually have to refresh the page 5-10 times before it actually comes up. I guess I am trying to see where exactly I should begin to look. </p> <p>ASP.NET MVC 3 Ninject AutoMapper Entity Framework Code First 4.1 SQL Server 2008 Razor</p> <p><strong>UPDATES</strong></p> <p>Concerning some of the questions, it can do this long loading on every page, but after it loads its fairly quick on all the pages.</p> <p>After posting this and getting your replies I started the application and it is still loading and probably won't ever load unless I click reload on the browser.</p> <p>No caching, and the EF models aren't huge.</p> <p>I am using Razor and Visual Studio 2010 with 6 GB of memory and an I7 processor. </p> <p>I am using IIS Express and the default web server when debugging. It also does this on IIS7 on the main server.</p> <p>I may look into the MVC Profiler and Glimpse to see what I can find.</p> <p>Below I have some code this runs when it hits the homepage. I would say it never loads when I first start up the server. I put a break point at var model which never gets hit. If I reload the page then it does.</p> <pre><code>public ActionResult Index() { var model = new HomeViewModel(); model.RecentHeadlines = _headlineService.GetHeadlines(1, Config.RecentHeadlinesPageSize, string.Empty); return View(model); } </code></pre> <p>Below is my datacontext setup also.</p> <pre><code>public class DatabaseFactory : Disposable, IDatabaseFactory { private DataContext _dataContext; public DataContext Get() { return _dataContext ?? (_dataContext = new DataContext()); } protected override void DisposeCore() { if (_dataContext != null) _dataContext.Dispose(); } } public class Disposable : IDisposable { private bool isDisposed; ~Disposable() { Dispose(false); } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } private void Dispose(bool disposing) { if (!isDisposed &amp;&amp; disposing) { DisposeCore(); } isDisposed = true; } protected virtual void DisposeCore() { } } public class UnitOfWork : IUnitOfWork { private readonly IDatabaseFactory _databaseFactory; private DataContext _dataContext; public UnitOfWork(IDatabaseFactory databaseFactory) { _databaseFactory = databaseFactory; } protected DataContext DataContext { get { return _dataContext ?? (_dataContext = _databaseFactory.Get()); } } public void Commit() { DataContext.Commit(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload