Visual Studio的调试/加载很慢 [英] Visual Studio Debugging/Loading Very Slow

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

问题描述

我在束手无策。 Visual Studio是的一般的痛苦而缓慢调试或只是简单的负载(不开始调试)我MVC网站。并不总是:首先,这些项目将加载很好,速度很快,但一旦他们加载缓慢,他们将永远载入后慢。我可以等待1-2分钟或更长时间。

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

我的设置:

我在使用Visual Studio 2012的前preSS,现在,但我已经在2010年同样的问题也是如此。我的解决方案存储在网络驱动器上;具体地讲,它是我的文档重定向到网络驱动器,如果它很重要。 [这不应该。有次在我的网站加载速度非常快这种设置下。]

I'm using Visual Studio 2012 express, currently, but I've had the same problem in 2010 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.]

我加载IE 9平时,但在Firefox同样的问题发生。

I load in IE 9 usually, but the same problem happens in FireFox.

这可以在任何MVC项目,我的工作发生了,似乎围绕其DisplayTemplates,这我所有的MVC项目做。而这一切都C#和放大器;剃刀,如果重要的。

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

症状:

,系统将载入我的符号的数百倍的。基本上,以下,但至少有300个这样的行,每行对于相同CSHTMLs不断所谓稍有不同的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 DLLs for the same CSHTMLs:

'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b63f8236\6775085d\App_Web_contact.cshtml.22013bb9.xighmhow.dll', Symbols loaded.
'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b63f8236\6775085d\App_Web_contact.cshtml.22013bb9.cv5hktkf.dll', Symbols loaded.
'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b63f8236\6775085d\App_Web_statuscode.cshtml.22013bb9.1o77hs8i.dll', Symbols loaded.
'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b63f8236\6775085d\App_Web_statuscode.cshtml.22013bb9.jja-77mw.dll', Symbols loaded.
'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b63f8236\6775085d\App_Web_location.cshtml.22013bb9.l_e9ev_s.dll', Symbols loaded.
'iisexpress.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b63f8236\6775085d\App_Web_location.cshtml.22013bb9.b4n59gom.dll', Symbols loaded.

在上面的,我有3 DisplayTemplates:联系人,位置和状态code。看来,IIS加载符号两次,每次的displaytemplate被调用的时间。因此,如果我在显示100个条目的表,调用这些displaytemplates所有3,它是装载600单独的符号。

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

这是不是一个快速的操作无论是。展望在IIS生成的日志文件,它需要200ms左右的每个符号加载。因此,超长时间的延迟。

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

我已经试过:


  • 调试或发布版本,无所谓。

  • 把我的项目在Web服务器上的完整的IIS执行运行时,它的超没有问题快。

  • 卡西尼,iisex $ P $ 7.5 PSS,iisex preSS 8.0都有这个问题。

  • 删除所有断点什么都不做。

  • 清理解决方案,或删除也名为.suo什么也不做。

  • 如果我修IISEx preS或删除我的文档\\ IISEx preSS文件夹,或修复/重新安装Visual Studio中 - >问题可能会消失,但只一会儿,才来到右后卫。

在所有的任何建议是AP preciated。

Any advice at all is appreciated.

----编辑#1 -----

---- Edit #1 -----

要回答更多的问题,是我的机器绝对有马力。真气的事情是,在同一个项目,什么也没有改变,可以装载非常非常快,有时,通常后,我修复IISEx preSS和放大器;删除我的文档\\ IISEx preSS文件夹中。最终,东西发生,这是下降到2分钟就再次加载。什么我工作不是一个复杂的工程。无需外部库或依赖性,我的VS.NET无插件什么那么远。

To answer more questions, yes my machine definitely has the horsepower. The infuriating thing is that the same project, with NOTHING altered, can load very very quickly sometimes, typically after I repair IISExpress & delete the My Docs\IISExpress 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 addons 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 (its good to be an admin) did not fix the problem.

我在这一点上的理论。我想这一切都是因为我的工作掀起了重定向的文件夹关闭网络共享。而调试器会通过它的数百个加载符号行,我停下来看看它在做什么。这是在我的code,加载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 it's 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:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b63f8236\6775085d\App_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:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b63f8236\6775085d\App_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'

看起来VS是重新编译我的displaytemplate的每次这就是所谓的,这又是,几百倍。我的理论是VS编译文件,将其保存到网络共享,网络共享然后以某种方式邮票新的时间就可以了,然后VS认为该文件已发生变化,从而VS再次重新编译它。只有理论虽然;我真的不知道。

It looks like VS is recompiling my displaytemplate every time it's called, which is again, hundreds of times. My theory is that VS compiles the file, saves it to the network share, the network share then somehow stamps a new time on it, and VS then thinks the file has changed and thus VS 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:修复它。它加载速度非常快。但是,这不是在工作环境中的理想。我输了previous版本,我的code未备份的水平,除非我手动复制它,它不再与任何人分享。

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来回网络共享,如果涉及到它。它更恼人的等待2分钟,每一个页面加载。

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

推荐答案

下面是我如何解决慢符号加载的问题的Visual Studio 2012:

Here is how I solved the "slow symbol loading" problem in Visual Studio 2012:


  • 进入工具 - >选项 - >调试 - >常规

  • Go to Tools -> Options -> Debugging -> General

检查对号旁边的启用仅我的code。

CHECK the checkmark next to "Enable Just My Code".

进入工具 - >选项 - >调试 - >符号

Go to Tools -> Options -> Debugging -> Symbols

点击...按钮,并在本地计算机上的某个地方创建/选择一个新的文件夹来存储缓存的符号。我将其命名符号缓存,并把它放在文档 - >的Visual Studio 2012

Click on the "..." button and create/select a new folder somewhere on your local computer to store cached symbols. I named mine "Symbol caching" and put it in Documents -> Visual Studio 2012.

点击加载所有的符号,并等待从微软服务器上下载的符号,这可能需要一段时间。 请注意,加载的所有符号按钮才可用,而调试。

Click on "Load all symbols" and wait for the symbols to be downloaded from Microsoft's servers, which may take a while. Note that Load all symbols button is only available while debugging.

从远程查询Microsoft服务器取消勾选标记旁边的微软符号服务器,以prevent的Visual Studio。

UNCHECK the checkmark next to "Microsoft Symbol Servers" to prevent Visual Studio from remotely querying the Microsoft servers.

点击确定。

从现在开始,符号加载要快很多。

From now on, symbol loading should be much faster.

请注意,如果你做任何更改/下载微软组件,您可能需要返回到符号对话框和加载所有符号了。

Note that if you make any changes/downloads to Microsoft assemblies, you may need to go back into the Symbols dialog box and "Load all symbols" again.

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

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