为什么ASP.NET / Visual Studio Web开发服务器这么慢? [英] Why is the ASP.NET/Visual Studio Web Development Server so slow?

查看:118
本文介绍了为什么ASP.NET / Visual Studio Web开发服务器这么慢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

xkcd

我知道现在的编译比以前快得多。但是对于我来说,似乎编译,特别是使用Visual Studio Web开发服务器运行/调试ASP.NET项目是非常缓慢的。

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.

自去年夏天开始,我一直在ASP.NET MVC项目上工作很多。当然,最好的调试方式是使用Visual Studio附带的Web服务器。当这样做的时候,我的载入时间很慢。 Chrome开发工具通常会报告,加载我的一个网页的时间是 3分钟等待时间,之后是加载时间较短。

Since the beginning of last summer, I've been working heavily on ASP.NET MVC projects. Of course, the best way to debug them is by using the web server that comes with Visual Studio. 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中进行大部分的调试工作,但在IE中也是如此。

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.

有没有人有这个问题?如果是这样,任何提示?

Has anyone else had this problem before? If so, any tips?

另外,我怀疑问题在于我的机器的速度。这台电脑真的很快运行Windows 7和Visual Studio 2010,所以我不明白为什么ASP.NET调试应该这么慢。

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.

更新:在下面的回答中,Jon Skeet建议尝试确定问题是由环境引起的还是由代码本身引起的。我创建了一个全新的MVC项目并运行它。第一个测试似乎要快得多。然而,经过几次测试,可以肯定的是,第一个测试是一个异常 - 通常,它需要与我的大项目(2 - 3分钟)一样长。因此,这是环境问题。感谢您提前获得任何帮助!

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. I created a brand new MVC project and ran it. 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). Thus, this is a problem with the environment. Thanks in advance for any help!

更新#2:更新了这个问题。以下是我上次更新以来收集的一些详细信息:

UPDATE #2: It's been a while since I updated this question. Here are some details I've gathered since my last update:


  • 这两个运行Windows 7的开发机器都发生这种延迟和Visual Studio 2010

  • 这个延迟正在发生在我所有的MVC2和MVC3项目(但我还没有尝试使用纯ASP.NET)

  • 平原/香草MVC项目经历与具有大代码库的MVC项目相同的延迟

  • 禁用IntelliTrace没有帮助

  • 禁用IPv6没有帮助

  • This delay is occuring on both of my development machines, both running Windows 7 and Visual Studio 2010
  • This delay is happening for all my MVC2 and MVC3 projects (but I haven't experimented with plain ASP.NET yet)
  • Plain/vanilla MVC projects experience the same delay as MVC projects with big codebases
  • Disabling IntelliTrace did not help
  • Disabling IPv6 did not help

我没有找到解决这个问题的解决方案,所以我一直呆在巨大的等待时间。有没有人知道如何解决这个问题?

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?

推荐答案

没有理由要花3分钟才能开始调试,除非你有一些非常奇怪的事情。

There's no reason why it should take 3 minutes to start debugging something unless you've got something really strange going on.

我建议您启动调试器,尝试导航到一个页面,然后在加载调试器时进入调试器。看看你在哪里失去时间也许你在启动时发出一些呼吁,这是失败的,但需要几分钟才能这样做。

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.

如果你创建一个全新的MVC项目并进行调试, 需要很长时间吗?

If you create a brand new MVC project and debug into that, does that take a long time?

您可能还想运行 Wireshark ,当您开始调试时 - 看到您的应用程序中的某些内容是否尝试获取某种描述的网络资源,而无需您实现。

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.

这篇关于为什么ASP.NET / Visual Studio Web开发服务器这么慢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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