This post was written by Rich Lander, a Program Manager on the .NET Framework Team. It was written for people who want to understand why mscorsvw.exe is running on their machines and want to know how to speed it up.
Have you noticed that your machine is slowing down, and you’ve looked in Task Manager to find that mscorsvw.exe is the culprit? If so, this post will help you resolve those performance issues. Mscorsvw.exe is a component of Windows, and is otherwise known as the .NET Framework Optimization Service. It optimizes your machine to launch apps faster.
Most of the time, users do not notice mscorsvw. If you are noticing it and would like it to stop affecting your computer’s performance, we recommend that you run the script provided below. This script will cause mscorsvw to run at maximum speed in order to complete its work faster, and will likely slow down your machine during that period of time. Once the script has completed its work, it will close itself. If you notice mscorsvw again, you can re-run this script, however, we hope you don’t need to do that.
- Click here: .NET Framework optimization speed up script
Upon clicking the link above, you will need to click through a set of dialogs asking you to open and run the script. Please do that. If you get asked which program to run the script with, choose the Windows Script Host. On Windows XP, you will need to save the script to your desktop (or another location on your computer) before running it (just double click on it).
Why do I need mscorsvw and the .NET Framework?
Millions of software developers around the world choose to write apps using the .NET Framework, which is provided by Microsoft. You’ve probably used many apps built with the .NET Framework without even knowing that. The .NET Framework includes a technology called Native Image Generator (NGEN) that makes apps launch much faster and that periodically does work to optimize your machine. You can read more about this technology in a related post: Got a need for speed? .NET apps start faster.
How can I tell if mscorsvw is running?
Task manager can tell you which apps or services are running on your machine and how much machine resources they are using. You can see mscorsvw.exe in Task Manager, highlighted below. You might see more than one reference to mscorsvw.exe in Task Manager. That’s OK and part of how it normally operates.
How often and when does mscorsvw run?
The .NET Framework optimization service runs at two main times:
- When the .NET Framework is installed on your machine.
- When the .NET Framework is serviced by Windows Update.
The first case doesn’t happen very often. The .NET Framework comes with Windows, so you often already have the .NET Framework version you need to run a given app. The second case happens more often. We update the .NET Framework a handful of times of year, usually to improve security. These updates will typically occur on a “patch Tuesday,” if you are familiar with that term.
We try to update and optimize the .NET Framework during the night (specific to each time zone), while most people are sleeping. Sometimes, it isn’t possible to do that, particularly if a machine is turned off. As a result, the .NET Framework is sometimes updated during the day, which then requires the .NET Framework Optimization Service to run during the day, too. When that happens, you might notice the service running and possibly slowing down your machine for a period of time. You might wonder why this is happening, since the .NET Framework Optimization service runs in the background.
In Windows 8, we changed the .NET Framework Optimization Service, to operate in more of a silent mode. It only does work during idle time (when you are not actively using your computer). That means that you should never notice it, even if it is operating during the day.
Can I disable or turn off mscorsvw?
We do not recommend turning off or killing the .NET Framework Optimization Service in Task Manager. It is performing an important task for your machine and will help your apps launch much faster, once it’s done that work.
However, you can speed up the .NET Framework Optimization Service. By default, it only uses one CPU core. Instead, you can tell it to get its work done as quickly as possible by using more cores (currently, it will not use more than 6). That way, it will get its work done faster, and you can get on to other things.
You can run this .NET Framework optimization speedup script (same one as provided above) to tell the .NET Framework Optimization Service to speed up. If you prefer PowerShell and have it installed, we’ve also provided a PowerShell script to speed up the optimization service. You will need to download the script to your machine, and call it from an admin PowerShell command prompt. The script needs to run under either RemoteSigned or Unrestricted PowerShell execution policy.
Note that the majority of the speed up occurs for the .NET Framework 4. If you only have the .NET Framework 2 or 3.5 installed, the speedup effect will be more minor.
Tell me more about the script. What are the mscorsvw commands?
The scripts we’ve provided are a convenience for people who don’t want to deal with a command prompt. If you prefer to use the command prompt, you can use the commands below instead. These commands depend on the version of the .NET Framework you have installed and the version of Windows that you have and whether it’s 32-bit or 64-bit.
- .NET 4, 4.5, or 4.5.1 Preview on Windows 7 or earlier:c:WindowsMicrosoft.NETFrameworkv4.0.30319ngen.exe executeQueuedItemsOn a 64-bit operating system, add:
c:WindowsMicrosoft.NETFramework64v4.0.30319ngen.exe executeQueuedItems
- .NET 4, 4.5, or 4.5.1 Preview on Windows 8 or 8.1 Preview:c:WindowsMicrosoft.NETFrameworkv4.0.30319ngen.exe executeQueuedItems
schTasks /run /Tn “MicrosoftWindows.NET Framework.NET Framework NGEN v4.0.30319″On a 64-bit operating system, add:
c:WindowsMicrosoft.NETFramework64v4.0.30319ngen.exe executeQueuedItems schTasks /run /Tn “MicrosoftWindows.NET Framework.NET Framework NGEN v4.0.30319 64”
- If you don’t have .NET 4 or later installed, but you do have .NET 2.0 or 3.5, use this command instead:c:WindowsMicrosoft.NETFrameworkv2.0.50727ngen.exe executeQueuedItemsOn a 64-bit operating system, add:
c:WindowsMicrosoft.NETFramework64v2.0.50727ngen.exe executeQueuedItems
These commands assume that Windows is installed on the C drive. If that’s not the case, you can change the drive letter, or use the %windir% environment variable (ex: %windir%Microsoft.NETFrameworkv4.0.30319ngen.exe executeQueuedItems)
These commands must be typed from a command prompt that you have “run as administrator”. If not, you will get an error message that directs you to run the commands with administrative credentials.
Summary
The .NET Framework is installed on over a billion machines and is used to run millions of apps every day. On the .NET Framework product team, we focus on making those apps launch as quickly as possible. A big part of how we do that is by optimizing both the .NET Framework and the apps that run on it. This optimization needs to be done on your machine a handful of times a year, due to updates to the .NET Framework.
You can learn more about .NET Framework optimization in our other post on this topic: Got a need for speed? .NET apps start faster.
The backslash characters in this article seem to have been lost over the years.