[英]Why is the ASP.NET/Visual Studio Web Development Server so slow?
I know that compiling nowadays is much faster than it was before. 我知道现在的编译速度比以前快得多。 Yet, for me, it seems that compiling and especially running/debugging ASP.NET projects with the Visual Studio Web Development Server is incredibly slow .
然而,对我来说, 使用Visual Studio Web开发服务器编译,尤其是运行/调试ASP.NET项目似乎非常慢 。
Since the beginning of last summer, I've been working heavily on ASP.NET MVC projects. 从去年夏天开始,我一直在努力研究ASP.NET MVC项目。 Of course, the best way to debug them is by using the web server that comes with Visual Studio.
当然,调试它们的最佳方法是使用Visual Studio附带的Web服务器。 When doing that, I get horrendously slow loading times.
这样做时,加载时间非常慢。 Chrome dev tools typically report that loading one of my pages had a 3 minute wait time , followed by a short loading time.
Chrome开发工具通常会报告加载我的一个页面有3 分钟的等待时间 ,然后加载时间很短。
I've seen these two questions, but they don't help. 我见过这 两个问题,但是没有用。 While I do most of my debugging work in Chrome, the same happens in IE.
虽然我在Chrome中进行了大部分调试工作,但在IE中也是如此。
Has anyone else had this problem before? 有没有其他人有这个问题? If so, any tips?
如果是这样,任何提示?
Also, I doubt that the problem lies with the speed of my machine. 另外,我怀疑问题在于机器的速度。 This computer is really fast running Windows 7 and Visual Studio 2010, so I don't see why ASP.NET debugging should be so slow.
这台计算机运行的Windows 7和Visual Studio 2010非常快,所以我不明白为什么ASP.NET调试应该这么慢。
UPDATE: In his answer below, Jon Skeet suggested attempting to identify whether the problem is being caused by the environment or by the code itself. 更新:在下面的回答中,Jon Skeet建议尝试确定问题是由环境还是由代码本身引起的。 I created a brand new MVC project and ran it.
我创建了一个全新的MVC项目并运行它。 The first test appeared to be much faster.
第一次测试似乎要快得多。 However, after testing it a few more times, it's safe to say that the first test was an anomaly - usually, it takes as long as my big project (2 - 3 minutes).
然而,经过几次测试之后,可以肯定地说第一次测试是异常的 - 通常,它需要我的大项目(2 - 3分钟)。 Thus, this is a problem with the environment .
因此, 这是环境问题 。 Thanks in advance for any help!
在此先感谢您的帮助!
UPDATE #2: It's been a while since I updated this question. 更新#2:我更新了这个问题已经有一段时间了。 Here are some details I've gathered since my last update:
以下是自上次更新以来我收集的一些细节:
I haven't found a solution for this problem, so I've been stuck with huge wait times. 我还没有找到解决这个问题的方法,所以我一直在等待很长时间。 Does anyone know how to solve this?
有谁知道如何解决这个问题?
There's no reason why it should take 3 minutes to start debugging something unless you've got something really strange going on. 没有理由为什么它需要3分钟才能开始调试,除非你有一些非常奇怪的事情发生。
I suggest you launch the debugger, try to navigate to a page and then just break into the debugger while it's loading. 我建议你启动调试器,尝试导航到一个页面,然后在加载时闯入调试器。 See where you're losing time.
看看你在哪里浪费时间。 Maybe you're making some call on startup which is failing, but taking minutes to do so.
也许你在启动时打电话给失败,但需要几分钟才能完成。
I've never experienced anything like what you're describing, which suggests it's either in your environment or in your code - and if it's a generally fast computer, that suggests it's somewhere in the code. 我从来没有经历过你所描述的任何事情,这表明它在你的环境或你的代码中 - 如果它是一个通常很快的计算机,那表明它在代码中的某个地方。
If you create a brand new MVC project and debug into that, does that take a long time? 如果您创建一个全新的MVC项目并进行调试, 那需要很长时间吗?
You might also want to run Wireshark when you start debugging - see whether something in your app is trying to fetch a network resource of some description without you realising it. 您可能还想在开始调试时运行Wireshark - 看看您的应用程序中的某些内容是否在尝试获取某些描述的网络资源而您没有意识到这一点。
This is due to the IPv6 DNS problem within Firefox and can be fixed by setting the
network.dns.disableIPv6
setting to true within theabout:config
这是由于Firefox中的IPv6 DNS问题,可以通过在
about:config
中将network.dns.disableIPv6
设置为true来修复
Slow DNS response - Firefox on localhost and Visual Studio or Cassini 缓慢的DNS响应 - 本地主机和Visual Studio或Cassini上的Firefox
This is actually a known performance issue with MVC, caused by throwing a ton of exceptions internally on startup. 这实际上是MVC的已知性能问题,这是由于在启动时内部抛出大量异常引起的。 If you have IntelliTrace turned on, this will wreck havoc with it.
如果你打开IntelliTrace,这将破坏它。 Try disabling IntelliTrace and see if that improves it at all.
尝试禁用IntelliTrace,看看是否能改善它。
Source: http://connect.microsoft.com/VisualStudio/feedback/details/535799/debugging-mvc-is-very-very-slow 资料来源: http : //connect.microsoft.com/VisualStudio/feedback/details/535799/debugging-mvc-is-very-very-slow
I met the same problem these days, working under Win7, VS2010, and developing a Silverlight solution with 10+ projects. 这些天我遇到了同样的问题,在Win7,VS2010下工作,并开发了一个包含10多个项目的Silverlight解决方案。 It takes about 3 minutes to launch IE, and waits 3 minutes to get back VS after closing IE.
启动IE需要大约3分钟,关闭IE后等待3分钟才能恢复VS. I overcame the problem by trying different ways.
我通过尝试不同的方式克服了这个问题。 But the only valuable method:
但唯一有价值的方法:
It seems the problem is just related with the VS environment on my side. 看来问题只与我身边的VS环境有关。 It has nothing to do with ASP.NET Development Server or IIS.
它与ASP.NET Development Server或IIS无关。
I was having the same problem. 我遇到了同样的问题。 It ended up being a problem with ColdFusion being installed on my local machine (as painful as it is for me to admit).
它最终成为我的本地机器上安装ColdFusion的问题(这对我来说是痛苦的)。 ColdFusion puts Handler Mappings named AboMapperCustom- * that were causing the latency.
ColdFusion将Handler Mappings命名为AboMapperCustom- * ,导致延迟。 I uninstalled ColdFusion because I no longer need it (thank God).
我卸载了ColdFusion因为我不再需要它(感谢上帝)。 Another solution could be to remove each AboMapperCustom entry through the web.config.
另一种解决方案是通过web.config删除每个AboMapperCustom条目。 Example:
例:
<handlers>
<remove name="AboMapperCustom-15397" />
<remove name="AboMapperCustom-20358" />
<remove name="AboMapperCustom-47286" />
</handlers>
Make sure the 5-digits following AboMapperCustom- match those in your local IIS Handler Mappings. 确保AboMapperCustom后面的5位数与本地IIS处理程序映射中的数字相匹配。
HTH HTH
On Visual Studio 2012 + Win10 x64, i've noticed that if you 在Visual Studio 2012 + Win10 x64上,我注意到了,如果你
then the server loads almost instantly 然后服务器几乎立即加载
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.