问题
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. E.g. 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:
- 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"
.
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.
For testing I´ve added another application to the same application pool - i.e.
C:\inetpub\wwwroot\test2"
- where I put a hello-world index.html. It loads fast. Therefore I expect a problem with MVC5.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!
回答1:
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.
来源:https://stackoverflow.com/questions/35379842/mvc-5-application-on-iis-8-in-windows-server-2012-virtual-machine-is-very-slow