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

时间:2021-10-09 02:01:55

为什么是ASP。NET/Visual Studio Web开发服务器这么慢?(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.

我知道现在的编译比以前快多了。然而,对我来说,编译,尤其是运行/调试ASP。与Visual Studio Web开发服务器的网络项目非常缓慢。

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.

从去年夏天开始,我就一直在学习ASP。净MVC项目。当然,调试它们的最好方法是使用带有Visual Studio的web服务器。这样做的时候,我的加载速度会非常慢。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. 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!

更新:在下面的回答中,Jon Skeet建议尝试识别问题是由环境还是代码本身引起的。我创建了一个全新的MVC项目并运行它。第一个测试似乎要快得多。然而,在多次测试之后,可以肯定地说,第一次测试是异常的——通常,它需要的时间和我的大项目一样长(2 - 3分钟)。因此,这是环境的问题。谢谢你的帮助!


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

更新2:我更新这个问题已经有一段时间了。以下是我上次更新后收集到的一些细节:

  • 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。净)
  • Plain/vanilla MVC projects experience the same delay as MVC projects with big codebases
  • 普通的/普通的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?

我还没有找到解决这个问题的办法,所以我不得不等待很长时间。有人知道怎么解决这个问题吗?

7 个解决方案

#1


8  

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—看看您的应用程序中的某些东西是否试图获取某种描述的网络资源,而您并没有意识到它。

#2


4  

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问题,可以通过设置network.dns来解决。disableIPv6设置在about:config中设置为true。

Slow DNS response - Firefox on localhost and Visual Studio or Cassini

慢速DNS响应——本地主机和Visual Studio或Cassini上的Firefox

#3


3  

This is actually a known performance issue with MVC, caused by throwing a ton of exceptions internally on startup. If you have IntelliTrace turned on, this will wreck havoc with it. Try disabling IntelliTrace and see if that improves it at all.

这实际上是MVC的一个众所周知的性能问题,它是由在启动时在内部抛出大量异常引起的。如果打开了IntelliTrace,那么它就会崩溃。尝试禁用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

#4


3  

Check out if this helps:

看看这是否有用:

http://blogs.msdn.com/b/mahuja/archive/2008/07/08/resolving-very-slow-symbol-loading-with-vs-2008-during-debugging.aspx

http://blogs.msdn.com/b/mahuja/archive/2008/07/08/resolving -非常缓慢——符号——加载期间与vs - 2008 - debugging.aspx

#5


1  

I met the same problem these days, working under Win7, VS2010, and developing a Silverlight solution with 10+ projects. It takes about 3 minutes to launch IE, and waits 3 minutes to get back VS after closing IE. I overcame the problem by trying different ways. But the only valuable method:

最近我遇到了同样的问题,在Win7、VS2010下工作,并开发了一个包含10多个项目的Silverlight解决方案。启动IE大约需要3分钟,关闭IE后需要3分钟才能返回。我通过尝试不同的方法克服了这个问题。但唯一有价值的方法是:

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

It seems the problem is just related with the VS environment on my side. It has nothing to do with ASP.NET Development Server or IIS.

这个问题好像和我这边的VS环境有关。它与ASP毫无关系。NET开发服务器或IIS。

#6


0  

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 puts Handler Mappings named AboMapperCustom-* that were causing the latency. I uninstalled ColdFusion because I no longer need it (thank God). Another solution could be to remove each AboMapperCustom entry through the web.config. Example:

我也有同样的问题。这最终导致了我在本地机器上安装ColdFusion的问题(尽管我承认这很痛苦)。ColdFusion将处理器映射命名为AboMapperCustom-*,这导致了延迟。我卸载ColdFusion,因为我不再需要它(谢天谢地)。另一种解决方案是通过web.config删除每个AboMapperCustom条目。例子:

<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

#7


0  

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

然后服务器几乎立即加载

#1


8  

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—看看您的应用程序中的某些东西是否试图获取某种描述的网络资源,而您并没有意识到它。

#2


4  

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问题,可以通过设置network.dns来解决。disableIPv6设置在about:config中设置为true。

Slow DNS response - Firefox on localhost and Visual Studio or Cassini

慢速DNS响应——本地主机和Visual Studio或Cassini上的Firefox

#3


3  

This is actually a known performance issue with MVC, caused by throwing a ton of exceptions internally on startup. If you have IntelliTrace turned on, this will wreck havoc with it. Try disabling IntelliTrace and see if that improves it at all.

这实际上是MVC的一个众所周知的性能问题,它是由在启动时在内部抛出大量异常引起的。如果打开了IntelliTrace,那么它就会崩溃。尝试禁用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

#4


3  

Check out if this helps:

看看这是否有用:

http://blogs.msdn.com/b/mahuja/archive/2008/07/08/resolving-very-slow-symbol-loading-with-vs-2008-during-debugging.aspx

http://blogs.msdn.com/b/mahuja/archive/2008/07/08/resolving -非常缓慢——符号——加载期间与vs - 2008 - debugging.aspx

#5


1  

I met the same problem these days, working under Win7, VS2010, and developing a Silverlight solution with 10+ projects. It takes about 3 minutes to launch IE, and waits 3 minutes to get back VS after closing IE. I overcame the problem by trying different ways. But the only valuable method:

最近我遇到了同样的问题,在Win7、VS2010下工作,并开发了一个包含10多个项目的Silverlight解决方案。启动IE大约需要3分钟,关闭IE后需要3分钟才能返回。我通过尝试不同的方法克服了这个问题。但唯一有价值的方法是:

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

It seems the problem is just related with the VS environment on my side. It has nothing to do with ASP.NET Development Server or IIS.

这个问题好像和我这边的VS环境有关。它与ASP毫无关系。NET开发服务器或IIS。

#6


0  

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 puts Handler Mappings named AboMapperCustom-* that were causing the latency. I uninstalled ColdFusion because I no longer need it (thank God). Another solution could be to remove each AboMapperCustom entry through the web.config. Example:

我也有同样的问题。这最终导致了我在本地机器上安装ColdFusion的问题(尽管我承认这很痛苦)。ColdFusion将处理器映射命名为AboMapperCustom-*,这导致了延迟。我卸载ColdFusion,因为我不再需要它(谢天谢地)。另一种解决方案是通过web.config删除每个AboMapperCustom条目。例子:

<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

#7


0  

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

然后服务器几乎立即加载