Visual Studio 调试/加载非常慢 [英] Visual Studio debugging/loading very slow

查看:160
本文介绍了Visual Studio 调试/加载非常慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经无计可施了.Visual Studio通常在调试或只是简单加载(启动而不调试")我的 ASP.NET MVC 站点时非常缓慢.并非总是如此:一开始,这些项目会加载得很好而且很快,但是一旦加载缓慢,之后它们就会总是加载缓慢.我可能要等 1-2 分钟或更长时间.

I'm at wit's end. Visual Studio is typically painfully slow to debug or just plain load ("start without debugging") my ASP.NET MVC sites. Not always: at first, the projects will load nice and fast, but once they load slow, they'll always load slowly after that. I could be waiting 1-2 minutes or more.

我的设置:

我目前使用的是 Visual Studio 2012 Express,但我也用过Visual Studio 2010 Express 中的问题也是如此.我的解决方案存储在网络驱动器上;具体来说,它是重定向到网络驱动器的我的文档"(如果重要的话).(不应该.在这种设置下,有时我的网站加载速度非常快.)

I'm using Visual Studio 2012 Express, currently, but I've had the same problem in Visual Studio 2010 Express as well. My solution is stored on a network drive; specifically, it's My Documents redirected to a network drive, if it matters. (It shouldn't. There are times where my site loads very fast under this setup.)

我通常在 Internet Explorer 9 中加载,但在 Firefox 中也会出现同样的问题.

I load in Internet  Explorer 9 usually, but the same problem happens in Firefox.

这可能发生在我从事的任何 ASP.NET MVC 项目中,而且似乎与我所有的 ASP.NET MVC 项目都有 DisplayTemplates 相关.如果这很重要,那就全是 C# 和 Razor.

This can happen in any ASP.NET MVC project I work on, and it seems to revolve around having DisplayTemplates, which all my ASP.NET MVC projects do. And it's all C# and Razor if that mattered.

系统将加载我的符号数百次.基本上如下,但至少有 300 行这样的行,对于相同的 CSHTML,每行都有略微不同的 DLL 文件:

The system will load my symbols hundreds of times. Basically, the following, but there are at least 300 such rows, each with ever-so-slightly different DLL files for the same CSHTMLs:

'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:WindowsMicrosoft.NETFrameworkv4.0.30319Temporary ASP.NET Files
oot63f82366775085dApp_Web_contact.cshtml.22013bb9.xighmhow.dll', Symbols loaded.
'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:WindowsMicrosoft.NETFrameworkv4.0.30319Temporary ASP.NET Files
oot63f82366775085dApp_Web_contact.cshtml.22013bb9.cv5hktkf.dll', Symbols loaded.
'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:WindowsMicrosoft.NETFrameworkv4.0.30319Temporary ASP.NET Files
oot63f82366775085dApp_Web_statuscode.cshtml.22013bb9.1o77hs8i.dll', Symbols loaded.
'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:WindowsMicrosoft.NETFrameworkv4.0.30319Temporary ASP.NET Files
oot63f82366775085dApp_Web_statuscode.cshtml.22013bb9.jja-77mw.dll', Symbols loaded.
'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:WindowsMicrosoft.NETFrameworkv4.0.30319Temporary ASP.NET Files
oot63f82366775085dApp_Web_location.cshtml.22013bb9.l_e9ev_s.dll', Symbols loaded.
'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:WindowsMicrosoft.NETFrameworkv4.0.30319Temporary ASP.NET Files
oot63f82366775085dApp_Web_location.cshtml.22013bb9.b4n59gom.dll', Symbols loaded.

在上面,我有三个 DisplayTemplates:Contact"、Location"和StatusCode".每次调用显示模板时,IIS 似乎都会加载两次符号.因此,如果我显示一个包含 100 个条目的表格,这些条目调用了所有这三个显示模板,则加载了 600 个单独的符号.

In the above, I've got three DisplayTemplates: "Contact", "Location", and "StatusCode". It appears that IIS is loading symbols twice for each time the display template gets called. Thus, if I'm displaying a table of 100 entries that call all three of these display templates, it's 600 separate symbols loaded.

这也不是一个快速的操作.IIS 生成的日志文件需要大约 200 毫秒才能加载每个符号.因此,超长延迟.

This isn't a fast operation either. The log files that IIS generates take about 200  ms for each symbol to load. Thus, super-long delays.

我的尝试:

  • 调试版或发布版,无所谓.
  • 将我的项目放在 Web 服务器上的完整 IIS 实现上运行速度超快,没有任何问题.
  • Cassini、IIS Express 7.5 和 IIS Express 8.0 都存在问题.
  • 删除所有断点没有任何作用.
  • Clean Solution,或者删除 .suo 也无济于事.
  • 如果我修复 IIS Express,或删除 My DocsIISExpress 文件夹,或修复/重新安装 Visual Studio → 问题可能会消失,但只会持续一段时间才会再次出现.
  • Debug or Release version, it doesn't matter.
  • Putting my project on a full IIS implementation on a web server runs it super fast with no problems.
  • Cassini, IIS  Express 7.5, and IIS  Express 8.0 all have the problem.
  • Delete All Breakpoints does nothing.
  • Clean Solution, or deleting the .suo also do nothing.
  • If I repair IIS  Express, or delete the My DocsIISExpress folder, or repair/reinstall Visual Studio → the issue MAY go away, but only for a while before it comes right back.

感谢任何建议.

要回答更多问题,是的,我的机器肯定有马力.令人气愤的是,同一个项目,没有任何改变,有时可以非常快速地加载,通常是在我修复 IIS Express 并删除 My DocsIISExpress 文件夹之后.最终,某物"出现了.发生了,再次加载只需 2 分钟.我正在做的不是一个复杂的项目.没有外部库或依赖项,我的 VS.NET 没有任何附加组件.

To answer more questions, yes my machine definitely has horsepower. The infuriating thing is that the same project, with NOTHING altered, can sometimes load very quickly, typically after I repair IIS  Express and delete the My DocsIISExpress folder. Eventually, "something" happens and it's down to 2 minutes to load again. What I'm working on is not a complicated project. No external libraries or dependencies and my VS.NET has no add-ons what-so-ever.

值得注意的是,这台机器有 Symantec Endpoint Protection,它有造成严重破坏的历史.但是完全禁用它(作为管理员很好)并没有解决问题.

Of note, this machine has Symantec Endpoint Protection, which has a history of causing havoc. But disabling it outright (it's good to be an administrator) did not fix the problem.

在这一点上我有一个理论.我想这就是全部,因为我正在处理网络共享中的重定向文件夹.当调试器正在检查它的数百个加载符号"时,线,我停下来看看它在做什么.它在我的代码中,加载了我拥有的 DisplayTemplate.进入模板输出:

I have a theory at this point. I'm thinking this is all because I'm working off a redirected folder off a network share. While the debugger was going through its hundreds of "loaded symbols" lines, I paused to see what it was doing. It was in my code, loading the DisplayTemplate I had. Stepping into the template output this:

Step into: Stepping over non-user code 'System.Threading.WaitHandle.InternalWaitOne'
Step into: Stepping over non-user code 'System.Threading.WaitHandle.WaitOne'
Step into: Stepping over non-user code 'System.CodeDom.Compiler.Executor.ExecWaitWithCaptureUnimpersonated'
Step into: Stepping over non-user code 'System.CodeDom.Compiler.Executor.ExecWaitWithCapture'
Step into: Stepping over non-user code 'Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch'
Step into: Stepping over non-user code 'Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromFileBatch'
Step into: Stepping over non-user code 'System.Web.Compilation.AssemblyBuilder.Compile'
'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:WindowsMicrosoft.NETFrameworkv4.0.30319Temporary ASP.NET Files
oot63f82366775085dApp_Web_statuscode.cshtml.22013bb9.bciuyg14.dll', Symbols loaded.
Step into: Stepping over non-user code 'System.Web.Compilation.BuildManager.CompileWebFile'
Step into: Stepping over non-user code 'System.Web.Compilation.BuildManager.GetVPathBuildResultInternal'
Step into: Stepping over non-user code 'System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert'
Step into: Stepping over non-user code 'System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory'
Step into: Stepping over non-user code 'System.Web.Mvc.BuildManagerWrapper.System.Web.Mvc.IBuildManager.FileExists'
Step into: Stepping over non-user code 'System.Web.Mvc.VirtualPathProviderViewEngine.GetPathFromGeneralName'
Step into: Stepping over non-user code 'System.Web.Mvc.VirtualPathProviderViewEngine.FindPartialView'
Step into: Stepping over non-user code 'System.Web.Mvc.ViewEngineCollection.Find'
Step into: Stepping over non-user code 'System.Web.Mvc.ViewEngineCollection.FindPartialView'
Step into: Stepping over non-user code 'System.Web.Mvc.Html.TemplateHelpers.ActionCacheViewItem.Execute'
'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:WindowsMicrosoft.NETFrameworkv4.0.30319Temporary ASP.NET Files
oot63f82366775085dApp_Web_statuscode.cshtml.22013bb9.kwj3uqan.dll', Symbols loaded.
Step into: Stepping over non-user code 'System.RuntimeType.CreateInstanceSlow'
Step into: Stepping over non-user code 'System.Web.Mvc.DependencyResolver.DefaultDependencyResolver.GetService'
Step into: Stepping over non-user code 'System.Web.Mvc.BuildManagerViewEngine.DefaultViewPageActivator.Create'
Step into: Stepping over non-user code 'System.Web.Mvc.BuildManagerCompiledView.Render'

看起来 Visual Studio 正在重新编译我的显示模板每次它被调用,这也是数百次.我的理论是 Visual Studio 编译文件,将其保存到网络共享,然后以某种方式在其上标记新时间,然后 Visual Studio 认为文件已更改.因此,Visual Studio 再次重新编译它.虽然只是一个理论;我真的不知道.

It looks like Visual Studio is recompiling my display template every time it's called, which is again, hundreds of times. My theory is that Visual Studio compiles the file, saves it to the network share, then somehow stamps a new time on it, and Visual Studio then thinks the file has changed. Thus, Visual Studio recompiles it yet again. Only a theory though; I really have no clue.

首先,显然,我有离线文件(这是办公室里的台式电脑;我不在乎).我要禁用,重新启动,然后明天重试.

For one, apparently, I have offline files on (this is a desktop computer in an office; I couldn't care less). I'm going to disable, reboot, and retry tomorrow.

另外,将我的项目按原样移动到本地 C: 修复了它.它加载非常快.但这在工作环境中并不理想.我丢失了以前的版本,除非我手动复制,否则我的代码根本没有备份,并且不再与任何人共享.

Plus, moving my project, as is, to the local C: fixes it. It loads very quickly. But this is not ideal in a work environment. I lose Previous Versions, my code isn't backed up at all unless I manually copy it, and it's no longer shared with anyone.

如果需要,我可以将它从 C 来回复制到网络共享.每次加载页面都要等待两分钟更烦人.

I can make do with copying it back and forth from C to the network share if it comes to it. It's much more annoying to wait two minutes for every page load.

推荐答案

这些都不适合我,但我在已删除的符号上发现了一个断点.似乎 2010 年就悬而未决.要查看这是否是您的问题,请执行 debug->windows->breakpoints 如果其中有,则删除它们.

None of this worked for me but I found a Breakpoint on a symbol that was deleted. Seems 2010 was hanging on it. To see if this is your issue do debug->windows->breakpoints If any are in there just delete them.

Saunders,提到他检查过这个问题,但在这个问题的解决方案中没有提到.可能是某些人的常识,但不是我们所有人的常识.

Saunders, mentioned he checked for that but it was not mentioned in the solutions for this problem. Maybe common knowledge for some, but not all of us.

这篇关于Visual Studio 调试/加载非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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