简体   繁体   中英

MVC 5 application on IIS 8 in Windows Server 2012 (virtual machine) is very slow (not only on initial load)

The goal is to launch an MVC 5 web app on an IIS 8 within a Windows Server 2012 (Standard edition for evaluation from Microsoft) in a virtual machine (VMware Workstation 12 Player, free version) in order to test the whole system for the release.

I managed to run the application, but the problem is, that it´s extremely slow. Eg the index.html is a static HTML page and needs more than 60 seconds to load. But why? In Visual Studio and IIS Express still everything works perfectly.

Futher information:

  1. On publishing, I precompiled the app. You can see the directory structure in the image below. I put these files into C:\\inetpub\\wwwroot\\test" .

在此处输入图片说明

  1. The target framework is .NET 4.6 . Therefore I´ve installed the .NET 4.6 package . The DefaultAppPool says v4.0, but apparently uses the correct 4.6 version.

  2. For testing I´ve added another application to the same application pool - ie C:\\inetpub\\wwwroot\\test2" - where I put a hello-world index.html. It loads fast. Therefore I expect a problem with MVC5 .

  3. The Windows Server 2012 is running in a virtual machine. I gave the VM 4GB RAM and 6 CPU Cores (hyperthreaded), but it didn´t help. The task manager shows a 5% CPU and 25% RAM consumption . Therefore I assume that the problem lies in the IIS .

I really appreciate your help!

Thanks, I have finally found the problem: I use the Sql Server LocalDb , which is a local .mdf-file in the filesystem. The Application Pool´s Identity was set to ApplicationPoolIdentity and I had to change it to LocalSystem . Now the application pool can access the database and the IIS runs as it should.

What surprised me is, that even though the IIS didn´t need the database to load the index.html, it apparently tried to establish a connection right away. After unsuccessful 60s it said, "Well I couldn´t connect, so I will try it without the database." and continued loading. In case the database was not needed, it worked. I guess that happens due to the DB-Connection-Pooling.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM