MVC App extremly slow entity-framework-6 iis


Using EF-6 and MVC, I created an web application.

This website was just put up on a new IIS server, a Windows Server 2012 R2 equipped with IIS8 and SQL Server 2016.

I currently have terrible load times. This, in my opinion, has something to do with the IIS. Because the load time is 220 milliseconds, with 48 milliseconds spent on SQL, when I launch the website on my development laptop and set it up to utilise the production database. The SQL-Server is on the other side of the VPN, so that's okay.

However, when I run the same code on the (production) IIS Server (with the database on the same server), I consistently receive a timing of 1808 milliseconds for the code in the using Block, with 1.7 milliseconds going toward the SQL-Connection.

Code is really straightforward:

public ActionResult Index()
    List<User> users;
    using (MiniProfiler.Current.Step("DB-Query"))
        users = db.Users.OrderByDescending(u => u.IsActive).ThenBy(u => u.ShortName).ToList();
    return View("Index", users);

Although I attempted remote debugging, single-stepping still results in an 1800 millisecond delay between the db.Users() and the brace.

Please be aware that the production database is empty and that this is one of the simplest controller techniques. The controller methods take around 100 times as long when there is real data in the database. as in the 60–90 seconds it takes my laptop to complete a task. 6 and 9 second.

Attempts I've made:

  • I reasoned that this may be the result of my renaming the database. As a result, I allowed the code-first migration to completely rebuild the database. Even more slowly.
  • I upgraded IIS on the webserver and reinstalled Inertia persisted.
  • Remote debugging, but it's just one step that takes 1800ms
  • various web browsers
2/21/2017 11:30:22 AM

Accepted Answer

By switching the connection string from "localhost" to "," the issue was resolved. The string was earlier:

Data Source=localhost;Initial Catalog=...;Integrated Security=True;Pooling=False;MultipleActiveResultSets=True

and here we are:

Data Source=;Initial Catalog=...;Integrated Security=True;Pooling=False;MultipleActiveResultSets=True

In, this is referenced.

5/23/2017 12:00:17 PM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow