本帖最后由 qq2348227 于 2022-8-29 20:51 编辑
用壹精简系统,美滋滋~哪曾想第二天就 .net runtime optimization service 持续高负载-远景论坛-微软极客社区 (pcbeta.com)
不要再害我们了…
另外,你不能 不忘初心老师正式入驻无忧,你就躲起来,不敢冒泡,不出作品了啊~
通过查找相关资料,发现这个进程是在系统安装了.NET Framework 或是.NET Framework 被更新之后,触发了.NET的最佳化服务,一旦它全部处理完毕,它将会终止,不再占用资源。我们不应该立即终止该进程,以免造成不可预测的后果,但我们可以加速该进程的运行,这是最好的解决方法。 把下面脚本保存到一个文本文件里,把文本文件扩展名改为.bat,然后使用管理员身份运行该脚本文件,即可加快这个服务的进度。
- # Script to force the .NET Framework optimization service to run at maximum speed.
- $isWin8Plus = [Environment]::OSVersion.Version -ge (new-object 'Version' 6,2)
- $dotnetDir = [environment]::GetEnvironmentVariable("windir","Machine") + "\Microsoft.NET\Framework"
- $dotnet2 = "v2.0.50727"
- $dotnet4 = "v4.0.30319"
- $dotnetVersion = if (Test-Path ($dotnetDir + "" + $dotnet4 + "\ngen.exe")) {$dotnet4} else {$dotnet2}
- $ngen32 = $dotnetDir + "" + $dotnetVersion +"\ngen.exe"
- $ngen64 = $dotnetDir + "64" + $dotnetVersion +"\ngen.exe"
- $ngenArgs = " executeQueuedItems"
- $is64Bit = Test-Path $ngen64
- #32-bit NGEN -- appropriate for 32-bit and 64-bit machines
- Write-Host("Requesting 32-bit NGEN")
- Start-Process -wait $ngen32 -ArgumentList $ngenArgs
- #64-bit NGEN -- appropriate for 64-bit machines
- if ($is64Bit) {
- Write-Host("Requesting 64-bit NGEN")
- Start-Process -wait $ngen64 -ArgumentList $ngenArgs
- }
- #AutoNGEN for Windows 8+ machines
- if ($isWin8Plus) {
- Write-Host("Requesting 32-bit AutoNGEN -- Windows 8+")
- schTasks /run /Tn "\Microsoft\Windows\.NET Framework\.NET Framework NGEN v4.0.30319"
- }
- #64-bit AutoNGEN for Windows 8+ machines
- if ($isWin8Plus -and $is64Bit) {
- Write-Host("Requesting 64-bit AutoNGEN -- Windows 8+")
- schTasks /run /Tn "\Microsoft\Windows\.NET Framework\.NET Framework NGEN v4.0.30319 64"
- }
复制代码
|