简体   繁体   English

为什么ASP.NET / Visual Studio Web开发服务器这么慢?

[英]Why is the ASP.NET/Visual Studio Web Development Server so slow?

编译 -  XKCD ( xkcd ) xkcd

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: 以下是自上次更新以来我收集的一些细节:

  • This delay is occuring on both of my development machines, both running Windows 7 and Visual Studio 2010 在我的两台开发机器上都出现了这种延迟,包括运行Windows 7和Visual Studio 2010
  • This delay is happening for all my MVC2 and MVC3 projects (but I haven't experimented with plain ASP.NET yet) 我的所有MVC2和MVC3项目都发生了这种延迟(但我还没有尝试过普通的ASP.NET)
  • Plain/vanilla MVC projects experience the same delay as MVC projects with big codebases Plain / vanilla MVC项目与具有大代码库的MVC项目经历了相同的延迟
  • Disabling IntelliTrace did not help 禁用IntelliTrace没有帮助
  • Disabling IPv6 did not help 禁用IPv6没有帮助

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 the about: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: 但唯一有价值的方法:

  1. Unload all projects not for debug 卸载所有不用于调试的项目
  2. Start debug the solution (it works normal ) 开始调试解决方案(它正常工作)
  3. Reload other projects 重新加载其他项目
  4. VS works normal here. VS在这里工作正常。 (VS works normal) (VS工作正常)

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上,我注意到了,如果你

  • go to the taskbar and find the asp.net dev server there, 转到任务栏并在那里找到asp.net dev服务器,
  • right click it and do a "show details" 右键单击它并执行“显示详细信息”
  • close the box (NOT 'stop', just close via 'x') 关闭方框(不是'停止',只是通过'x'关闭)

then the server loads almost instantly 然后服务器几乎立即加载

暂无
暂无

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

相关问题 Visual Studio 2010为.NET 3.5 ASP.NET应用程序启动.NET 2.0开发服务器 - Visual Studio 2010 launching .NET 2.0 Development Server for .NET 3.5 ASP.NET Application Visual Studio 2010-应用程序无法通过asp.NET开发服务器启动,但可以在生产服务器上运行 - Visual Studio 2010 - Application not starting up through asp.NET Development Server but works on the Production Server 如何将 ASP.NET 和 web 开发 package 添加到现有的 Visual Studio - How to add ASP.NET and web development package to existing visual studio 在ASP.NET MVC visual studio开发服务器中设置启动路径 - Set start route in ASP.NET MVC visual studio development server ASP.NET MVC错误消息“无法连接到Visual Studio开发服务器”。 - ASP.NET MVC error message 'Unable to connect to the Visual Studio Development Server.' ASP.net MVC:为什么 AreaRegistration.RegisterAllAreas() 这么慢? - ASP.net MVC: why is AreaRegistration.RegisterAllAreas() so slow? 如何使用 Visual Studio 将 ASP.NET Web 应用程序 (.Net Framework) 发布到 FTP 服务器? - How to Publish ASP.NET Web Application (.Net Framework) with Visual Studio to FTP Server? 如何在 Visual Studio Asp.net 项目中为不同的团队成员设置不同的 web 服务器配置? - How to set up different web server config for different team members in Visual Studio Asp.net Project? ASP.NET MVC 5开发太慢 - ASP.NET MVC 5 is too slow on development 为什么我的 ASP.NET Web 表单呈现缓慢? - Why is my ASP.NET Web forms rendering slow?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM