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)

查看:260
本文介绍了Windows Server 2012(虚拟机)中的IIS 8上的MVC 5应用程序非常慢(不仅在初始加载时)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目标是在 Windows Server 2012 内的 IIS 8 上启动 MVC 5 Web应用程序(Microsoft评估的标准版) )在虚拟机(VMware Workstation 12 Player,免费版)中进行测试,以测试整个系统的发行版.

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.

我设法运行了该应用程序,但问题是它的运行速度非常慢.例如. index.html是静态HTML 页面,需要 60秒以上才能加载.但为什么?在Visual Studio和IIS Express中,一切仍然可以正常运行.

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.

更多信息:

  1. 发布时,我预编译了该应用.您可以在下图中看到目录结构.我将这些文件放入C:\inetpub\wwwroot\test".
  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. 目标框架是 .NET 4.6 .因此,我已经安装了. NET 4.6程序包. DefaultAppPool 表示v4.0,但显然使用了正确的4.6版本.

  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.

为了进行测试,我已将另一个应用程序添加到了相同的应用程序池中-即C:\inetpub\wwwroot\test2"-在其中放置了hello-world index.html.它加载速度很快.因此,我希望MVC5有一个问题.

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.

Windows Server 2012在虚拟机中运行.我为VM提供了4GB RAM和6个CPU内核(超线程),但这并没有帮助.任务管理器显示 5%CPU 25%RAM消耗.因此,我认为问题出在IIS 中.

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.

非常感谢您的帮助!

推荐答案

谢谢,我终于找到了问题:我使用Sql Server LocalDb ,它是文件系统. 应用程序池的标识设置为 ApplicationPoolIdentity ,我不得不将其更改为 LocalSystem .现在,应用程序池可以访问数据库,并且IIS可以正常运行.

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.

让我感到惊讶的是,即使IIS不需要数据库来加载index.html,它显然也试图立即建立连接.失败60秒钟后,它说:"我无法连接,所以我将在没有数据库的情况下进行尝试." 并继续加载.万一不需要数据库,它就可以工作.我猜这是由于DB-Connection-Pooling造成的.

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.

这篇关于Windows Server 2012(虚拟机)中的IIS 8上的MVC 5应用程序非常慢(不仅在初始加载时)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆