Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to kill mscorsvw.exe

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

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?

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.

like image 851
Adam Rackis Avatar asked Jun 24 '11 15:06

Adam Rackis


2 Answers

Try

ngen queue status

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

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.

like image 83
Hans Passant Avatar answered Oct 30 '22 13:10

Hans Passant


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?

Nope; it doesn't kill it. Instead it makes it intentionally worse. 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

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

  • http://techdows.com/2010/08/what-is-mscorsvw-exe-how-to-disable-it.html
like image 34
sehe Avatar answered Oct 30 '22 13:10

sehe