简体   繁体   English

Windows Server 2012(虚拟机)中的IIS 8上的MVC 5应用程序非常慢(不仅在初始加载时)

[英]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. 目标是在虚拟机 (VMware Workstation 12 Player,免费版)中的Windows Server 2012 (Microsoft评估标准版)中的IIS 8上启动MVC 5 Web应用程序,以测试整个系统的发行版。

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. 例如,index.html是静态HTML页面,需要60秒钟以上的时间来加载。 But why? 但为什么? In Visual Studio and IIS Express still everything works perfectly. 在Visual Studio和IIS Express中,一切仍然可以正常运行。

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" . 我将这些文件放入C:\\inetpub\\wwwroot\\test"

在此处输入图片说明

  1. The target framework is .NET 4.6 . 目标框架是.NET 4.6 Therefore I´ve installed the .NET 4.6 package . 因此,我已经安装了.NET 4.6软件包 The DefaultAppPool says v4.0, but apparently uses the correct 4.6 version. DefaultAppPool表示v4.0,但显然使用了正确的4.6版本。

  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 . 为了进行测试,我在同一应用程序池中添加了另一个应用程序-即C:\\inetpub\\wwwroot\\test2" -在其中放置了hello-world index.html。它加载速度很快。因此,我希望MVC5出现问题

  3. The Windows Server 2012 is running in a virtual machine. Windows Server 2012在虚拟机中运行。 I gave the VM 4GB RAM and 6 CPU Cores (hyperthreaded), but it didn´t help. 我为VM提供了4GB RAM和6个CPU内核(超线程),但这并没有帮助。 The task manager shows a 5% CPU and 25% RAM consumption . 任务管理器显示5%的CPU25%的RAM消耗 Therefore I assume that the problem lies in the IIS . 因此,我认为问题出在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. 谢谢,我终于找到了问题:我使用Sql Server LocalDb ,它是文件系统中的本地.mdf文件。 The Application Pool´s Identity was set to ApplicationPoolIdentity and I had to change it to LocalSystem . 应用程序池的标识设置为ApplicationPoolIdentity ,我不得不将其更改为LocalSystem Now the application pool can access the database and the IIS runs as it should. 现在,应用程序池可以访问数据库,并且IIS可以正常运行。

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. 令我惊讶的是,即使IIS 不需要数据库来加载index.html,它显然也试图立即建立连接。 After unsuccessful 60s it said, "Well I couldn´t connect, so I will try it without the database." 失败60 秒钟后,它说: “好吧,我无法连接,所以我将在没有数据库的情况下进行尝试。” and continued loading. 并继续加载。 In case the database was not needed, it worked. 万一不需要数据库,它就可以工作。 I guess that happens due to the DB-Connection-Pooling. 我猜这是由于DB-Connection-Pooling而发生的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用本地计算机上的IIS8在Windows Server 2012上托管Asp.Net MVC 4应用程序 - Hosting an Asp.Net MVC 4 application on windows server 2012 with IIS8 from a Local Machine 在Windows 2012服务器IIS 8.0中进行IIS调试 - IIS debugging in windows 2012 server IIS 8.0 从Visual Studio启动时,WPF应用程序加载初始窗口非常慢 - WPF Application very slow to load initial window when launched from Visual Studio 在Windows Server 2012中部署ASP.NET MVC 5应用程序 - Deploying a ASP.NET MVC 5 Application in Windows Server 2012 ASP.NET MVC - 缓慢的初始加载 - ASP.NET MVC - Slow initial load IIS中的虚拟MVC应用程序中的标头行为 - Header behaviour in a virtual MVC application in IIS MVC应用程序中的表联接非常慢 - A table join in MVC application is being very slow ZeroMQ上下文未在Windows Server 2012计算机上初始化 - ZeroMQ context not initializing on Windows Server 2012 machine Asp.Net httpcontext.current.request在运行iis7的虚拟Windows Server 2012上有效,但在Windows Server 2016 iis10上无效 - Asp.Net httpcontext.current.request works on virtual windows server 2012 running iis7 but not on windows server 2016 iis10 应用程序在Server 2012和IIS 8.5上意外重新启动 - Application restarted unexpectedly on Server 2012 and IIS 8.5
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM