MVC App extremly slow

asp.net entity-framework-6 iis

Question

Using EF-6 and MVC, I created an asp.net 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 Asp.net. Inertia persisted.
  • Remote debugging, but it's just one step that takes 1800ms
  • various web browsers
1
1
2/21/2017 11:30:22 AM

Accepted Answer

By switching the connection string from "localhost" to "127.0.0.1," 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=127.0.0.1;Initial Catalog=...;Integrated Security=True;Pooling=False;MultipleActiveResultSets=True

In https://stackoverflow.com/a/13776955/1974021, this is referenced.

1
5/23/2017 12:00:17 PM


Related Questions





Related

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