How to Fix High CPU Usage by .NET Runtime Optimization Service?

High CPU Usage by the NET Runtime Optimization Service can occur unexpectedly or following an update to the .NET Framework. The related process, identified as mscorsvw.exe, appears in the Task Manager as .NET Runtime Optimization Service. This service optimizes the .NET Framework to enhance the performance of dependent applications and programs.

Officially, this process should recompile its libraries only when the computer is idle, completing in a few minutes. However, the optimization process can sometimes extend unnecessarily, with users reporting significant CPU consumption for several days.

What Causes High CPU Usage by the .NET Runtime Optimization Service?

  • The process is running slowly; speeding it up might be possible by executing specific commands.
  • Your computer could be hosting malware disguising itself as the service or infecting it. Running a malware scanner is recommended.
  • The service could be corrupted. Restarting it might resolve the issue.

To resolve this issue, follow the methods provided below.

1. Optimize the Process Manually

Optimizing the process involves executing specific commands that prompt the .NET Runtime Optimization Service to complete its tasks more efficiently, utilizing more CPU cores if necessary.

  1. Search for Command Prompt via the Search button. Right-click on the top result and select Run as administrator.
    Running Command Prompt as an administrator
  1. Copy and paste the following commands, hitting Enter after each. Select the command corresponding to your system architecture (32-bit for the first and 64-bit for the second).
    cd c:\Windows\Microsoft.NET\Framework\v4.0.30319 
    cd c:\Windows\Microsoft.NET\Framework64\v4.0.30319
    ngen.exe executequeueditems
    
  2. Verify if the .NET Runtime Optimization Service CPU usage has normalized.

Alternative: If you are uncomfortable running commands or are on an older Windows version, consider using Microsoft’s official script for a similar outcome.

  1. Open this link for the GitHub script page. Right-click the Raw button, choose Save link as…, and ensure the file type is Windows Script File (*.wsf).
    Saving the script from GitHub
  2. Find the file you saved and double-click to execute it. If asked which program to use, pick Windows Script Host.
  3. Check if the issue has been resolved.

2. Scan Your Computer for Malware

Malware infections are a common cause of this problem. Conduct a malware check on your system, as malicious software can take control of system resources and disguise itself as legitimate system files.

  1. Download Malwarebytes Anti-Malware from their official website by clicking here.
  2. Find the downloaded installer in the Downloads folder and double-click to initiate installation. Follow on-screen instructions to complete the installation process.
    Installing Malwarebytes
  3. Open Malwarebytes, select the Scan option, and allow time for the scan and potential database update to complete.
    Running the scan in Malwarebytes
  4. Reboot your computer post-scan to determine if the .NET Runtime Optimization Service is functioning normally.

3. Restart the Service

Restarting the service can reset the .NET Runtime Optimization Service, clearing any temporary glitches or issues causing excessive CPU consumption.

  1. Open the Run utility using Windows Key + R, type in services.msc, and press OK to open the Services tool.
    Running Services Manager
  2. Find the Microsoft .NET Framework NGEN v4.0.30319_X86 service (for 32-bit systems) or Microsoft .NET Framework NGEN v4.0.30319_X64 service (for 64-bit systems), right-click it, and choose Properties.
  3. Stop the service if it’s running, then restart it by clicking Start.
    Starting the service
  4. In the service’s properties window, ensure the Startup type is set to Automatic, accepting any dialogue prompts to confirm the change.

An error message might occur upon attempting to start the service:

Windows could not start the service on Local Computer. Error 1079: The account specified for this service differs from the account specified for other services running in the same process.

If this issue occurs, follow these steps to resolve it:

  1. Repeat steps 1-3 to access the service’s properties. Proceed to the Log On tab and select Browse….
    Log On >> Browse
  2. Enter your account’s name where it states Enter the object name to select, click Check Names to validate, and press OK.
  3. When prompted, enter your password to start the service smoothly.

4. Perform a Clean Boot

Performing a Clean Boot can help resolve high CPU usage by starting Windows with a minimal set of drivers and startup programs, eliminating software conflicts from multiple applications and services loading during startup.

Follow our clean boot guide, then check the CPU usage. If it has lowered, a third-party application was likely responsible. You can further isolate the problematic software by reactivating applications individually.

ABOUT THE AUTHOR

Kevin Arrows


Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.