.net 如何杀死 mscorsvw.exe

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6469724/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 15:41:16  来源:igfitidea点击:

How to kill mscorsvw.exe

.netvisual-studiongen

提问by Adam Rackis

mscorsvw.exe (a.NET optimization that precompiles assemblies) is taking up a substantial percentage of my CPU - 50-100%.

mscorsvw.exe(预编译程序集的 .NET 优化)占用了我 CPU 的很大一部分 - 50-100%。

This article (and many others) say that

这篇文章(和许多其他文章)说

ngen.exe executequeueditems

ngen.exe 执行队列项

From the command line should kill it. For me, that command just hangs. Is there some better way to kill this process?

从命令行应该杀死它。对我来说,该命令只是挂起。有没有更好的方法来终止这个过程?

I have not tried rebooting. I've seen my CPU utilization spike up more than once in the last few days, and I suspect this has been my problem; I'd like to know how to kill it going forward.

我没有试过重启。在过去的几天里,我看到我的 CPU 使用率飙升不止一次,我怀疑这是我的问题;我想知道如何杀死它。

回答by Hans Passant

Try

尝试

ngen queue status

Hopefully is shows more than just "I'm running" and shows what it is trying to compile. The ngen queue stopcommand will stop the service.

希望不仅仅是“我正在运行”,而是显示它正在尝试编译的内容。该ngen queue stop命令将停止服务。

This service starts running when an installer deployed an assembly and asked the service to pre-compile it with ngen install. Clearly you've got a bad one on your machine, I'd guess that it is failing over and over again to compile an assembly. Check the Windows event log for a breadcrumb about this. Uninstall the program that did this.

当安装程序部署程序集并要求服务使用ngen install. 很明显,你的机器上有一个坏的,我猜它在编译程序集时一遍又一遍地失败。检查 Windows 事件日志以获取有关此的面包屑。卸载执行此操作的程序。

回答by sehe

This article (and many others) say that

ngen.exe executequeueditems

From the command line should kill it. For me, that command just hangs. Is there some better > way to kill this process?

这篇文章(和许多其他文章)说

ngen.exe 执行队列项

从命令行应该杀死它。对我来说,该命令只是挂起。有没有更好的 > 方法来终止这个过程?

Nope; it doesn't kill it. Instead it makes it intentionallyworse. Instead of trickling background compiles (so that you normally wouldn't notice it), it will process all queued items at once. This will take some time to finish. It doesn't hang, it will be working very hard. When it's done, it's done, and there will be no more things left to background-compile.

不; 它不会杀死它。相反,它故意使情况变得更糟。而不是涓涓细流的后台编译(这样你通常不会注意到它),它将一次处理所有排队的项目。这将需要一些时间才能完成。它不会挂起,它会非常努力地工作。当它完成时,它就完成了,并且没有更多的东西需要后台编译。

Note that the background compilation jobs have been added (most likely) by a recent upgrade (you probably installed a service pack). Windows is doing you a favour by AOT-compiling all the managed assemblies using the .NET JIT compiler which knows all about your exact hardware and processor type, so that it will emit the most optimized code. In this way, .NET ensures that software run faster in the future, at the cost of compiling your assemblies now

请注意,最近的升级(您可能安装了服务包)已添加(最有可能)后台编译作业。Windows 通过使用 .NET JIT 编译器对所有托管程序集进行 AOT 编译来帮您一个忙,该编译器了解您的确切硬件和处理器类型,因此它会发出最优化的代码。通过这种方式,.NET 确保软件在未来运行得更快,代价是现在编译你的程序集

Of the many resources you indirectly linked to yoursef, read this one e.g.:

在您间接链接到 yoursef 的许多资源中,请阅读以下资源,例如:

回答by DAGwyn

.NET, in my opinion, has some questionable design, when a "Just In Time" compiler is required to run through everything to compile it before It's Time.

在我看来,.NET 有一些有问题的设计,当需要“及时”编译器来运行所有内容以在 It's Time 之前编译它时。

There are normally two mscorsvwdaemons running, one for 64-bit and one for 32-bit (they synchronize with each other). The 100% CPU utilization is what you expect for a compiler, but it's done at low priority, and no more than one core should be tied up at a time. One advantage of multi-core CPUs is that things like these still leaves you a core to drive the user-interface interaction. (Note that the search indexer is another daemon of the same general kind, designed along the same lines.) If you have a single-core CPU then you'll really notice the added load.

通常有两个mscorsvw守护进程在运行,一个用于 64 位,一个用于 32 位(它们彼此同步)。100% 的 CPU 利用率是您对编译器的期望,但它以低优先级完成,并且一次不应占用超过一个内核。多核 CPU 的一个优点是,像这样的东西仍然让您成为驱动用户界面交互的核心。(请注意,搜索索引器是另一个同类的守护进程,按照相同的方式设计。)如果您有一个单核 CPU,那么您会真正注意到增加的负载。

回答by 84RR1573R

Sometimes this causes on a typical bug basis. My case of SQL Server msiexec.exe processes keep running after installation of SQL Server 2012 SP1Wait for next update as per usual.

有时这会导致典型的错误。我的 SQL Server msiexec.exe 进程在安装 SQL Server 2012 SP1 后继续运行,照常等待下一次更新。

回答by Sar

I had the same issue after installing SQL 2012. After running the command ngen queue status, I saw it was the CLR optimization proces that was running. Again using this thread I was able to see there were two services Microsoft.NET Framework NGEN v4.0.30319_X64 and Microsoft.NET Framework NGEN v4.0.30319_X64 indicating the 32 bit and 64 bit optimmization code.

安装 SQL 2012 后,我遇到了同样的问题。运行命令 ngen queue status 后,我看到正在运行的是 CLR 优化过程。再次使用此线程,我能够看到有两个服务 Microsoft.NET Framework NGEN v4.0.30319_X64 和 Microsoft.NET Framework NGEN v4.0.30319_X64 表示 32 位和 64 位优化代码。

I saw that these two were started, and the x86 version was the culprit. I stopped the service and the CPU came back from 100% to 0% and memory reduced by about 2GB.

看到这两个启动了,x86版本是罪魁祸首。我停止了服务,CPU 从 100% 恢复到 0%,内存减少了大约 2GB。

回答by Relth

Look, .NET murders single core media center PCs. Old computers slow for hours, web based video becomes unwatchably choppy. So much for energy efficiency - must I leave my PC compiling 24/7 to be occasionally caught up? User-directed processes do not take priority. Best yet it won't step aside for automatic updates... including of .NET! Which induce another recompile of all resources, never to finish before Patch Tuesday. I haven't found the suggested workarounds ('ngen.exe install /queue' or 'ngen.exe update' - find ngen in the relevant framework directory) responsive. So. I DISABLE Microsoft .NET Framework NGEN service in services.msc - or via command line ('sc config clr_optimization_v4.xxxx start= disabled' where xxxx is version number; get version number via sc query or directory name or services.msc); 'stop' just restarts within seconds. Consider or attempt total removal of .NET 4.

看,.NET 谋杀了单核媒体中心 PC。旧电脑慢了几个小时,基于网络的视频变得难以观看。能源效率如此之高 - 我必须让我的 PC 24/7 全天候编译以偶尔赶上吗?用户导向的进程不具有优先权。最好的是,它不会为自动更新而搁置……包括 .NET!这会导致再次重新编译所有资源,永远不会在补丁星期二之前完成。我没有发现建议的解决方法('ngen.exe install /queue' 或 'ngen.exe update' - 在相关框架目录中找到 ngen)响应。所以。我在 services.msc 中禁用 Microsoft .NET Framework NGEN 服务 - 或通过命令行('sc config clr_optimization_v4.xxxx start= disabled',其中 xxxx 是版本号;通过 sc 查询或目录名称或 services.msc 获取版本号);' 停止'只是在几秒钟内重新启动。考虑或尝试完全删除 .NET 4。