ngen.exe 높은 CPU Windows 10 - 어셈블리 제거 끝없는 루프

ngen.exe 높은 CPU Windows 10 - 어셈블리 제거 끝없는 루프

몇 분 동안 컴퓨터를 유휴 상태로 둘 때마다 다시 돌아오면 Process Explorer에 'ngen.exe'가 실행 중이며 CPU 4개 중 2개를 점유하고 있는 것으로 표시됩니다.

질문: NGEN.exe를 백그라운드 작업으로 끌 수 있는 방법이 있습니까?

나는 컴퓨터를 유휴 상태로 둘 때마다 컴퓨터를 '자동으로' 컴파일하는 대신 (인터넷의 다른 많은 사람들처럼) 모든 .net 바이너리를 한 번에 컴파일하고 싶습니다. Microsoft 포럼 전체를 확인했지만 지금까지 이 문제에 대한 완전한 답변을 가진 사람이 없으며 많은 사람들이 동일한 문제를 겪고 있습니다.

분명히 .net 프레임워크의 일부 라이브러리를 다시 컴파일해야 하는데 '고착'되어 CPU를 높은 상태로 만들고 계속해서 루프를 반복합니다.

방금 동일한 문제를 경험했는데 다른 스레드가 있습니다.답변을 시도하지만 불완전합니다.

/HKLM/SOFTWARE/Microsoft/Windows/Current Version/RUN의 Regedit에는 .net 컴파일러를 실행하기 위한 항목이 없습니다. 다른 문제로 인해 ngen.exe가 실행되어야 합니다.

누군가 이 기능을 실행할 수 있는 다른 위치를 게시할 수 있나요?

다른 많은 사람들도 그럴 것이라고 확신하므로 나는 이 기능을 끄고 싶습니다. Windows 10에서도 자동 업데이트를 비활성화했습니다.

업데이트: 프로세스 탐색기에 따르면 이것이 실행 중이라고 합니다.

"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe" 제거 "C:\WINDOWS\assemble\NativeImages_v4.0.30319_64\Microsoft.Vf‌​9a08577#\328b1bc4205‌​c08821860805bf5e6c99‌​e\Microsoft.VisualSt‌ ​udio.Tools.Applicati‌​ons.Hosting.ni.dll" /noroot /LegacyServiceBehavior – Viktor 5분 전

"C:\Windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe" 제거 "C:\WINDOWS\assemble\NativeImages_v2.0.50727_32\Presentation‌​Framewo#\7fa93028119‌​b98117acfd5ea18f15c1‌​3\PresentationFramew‌​ork.ni .dll" /noroot /LegacyServiceBehavior – Viktor 4분 전 편집

"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe" 제거 "C:\WINDOWS\assemble\NativeImages_v2.0.50727_64\Microsoft.PowerShel#\23dfb41f48958215c80bbbc0c9177cb2\Microsoft.PowerShell.Commands.Utility.ni .dll" /noroot /LegacyServiceBehavior

계속해서 계속해서 실행되고 있습니다. - 프로세스 탐색기의 출력입니다. 그것은 매우 짜증나는 일이며 책상을 떠날 때마다 일어나는 것 같습니다.

질문: 이는 합법적인 프로세스인 것 같습니다. 제거 명령을 수동으로 제거하고 반복해서 반복하는 대신 .net 프레임워크를 완전히 한 번 컴파일하는 방법을 아는 사람이 있습니까?

현재 테스트 중: 프로세스를 종료하고 ngentask.exe를 Windows\assemblies로 이동하여 해당 네이티브 이미지 폴더를 임시 디렉터리로 이동했습니다. 다시 시작되면 알려드리겠습니다. NativeImages 폴더가 누락된 경우 해당 어셈블리를 계속 제거하려고 시도하지 않을 가능성이 있습니다.

답변1

Easy NGEN 스크립트 다운로드, 관리자 권한으로 실행하고 옵션 1을 선택하여 전체 ngen 실행을 수행합니다.

여기에 이미지 설명을 입력하세요

이 작업에는 많은 시간이 걸리며 보류 중인 모든 ngen 작업을 수행합니다. 그 후에는 ngen 대기열이 비어 있으므로 다른 작업이 다시 표시되지 않아야 합니다.

(링크가 작동하지 않으면 코드를 복사하여 txt 파일에 붙여넣고 이름을 cmd로 바꿉니다.)

@echo off
title Easy Ngen Runner v5 for '.NET 4.x series' by Burf

"%windir%\system32\reg.exe" query "HKU\S-1-5-19" >nul 2>&1 && (
goto :admincheckok
) || (
echo      -------
echo  *** WARNING ***
echo      -------
echo.
echo.
echo ADMINISTRATOR PRIVILEGES NOT DETECTED!
call :line
echo.
echo.
echo This script must be run with administrator privileges!
echo.
echo To do so, right click on this script and select 'Run As Administrator'
echo.
goto :fin
)

:admincheckok

"%windir%\system32\reg.exe" query "hklm\software\microsoft\Windows NT\currentversion" /v buildlabex >"%temp%\os.txt"
find /i "AMD64" <"%temp%\os.txt">nul
if %errorlevel% equ 0 (set arch=x64) else (set arch=x86)

for /f "tokens=3* delims= " %%G in ('reg query "hklm\software\microsoft\Windows NT\currentversion" /v productname') do (set winv=%%G %%H)
echo %winv%|find /i "Windows 10" >nul
if errorlevel 0 (set w10=1&for /f "tokens=3" %%G in ('reg query "hklm\software\microsoft\Windows NT\currentversion" /v UBR') do (set /a UBR=%%G))
if defined w10 (for /f "skip=2 tokens=3,4,6,7 delims=. " %%G in ('type "%temp%\os.txt"') do (set "win=%winv% %arch% Build %%G.%UBR% {%%I %%J}")
) else (
for /f "skip=2 tokens=3,4,6,7 delims=. " %%G in ('type "%temp%\os.txt"') do (set "win=Legacy %winv% %arch% Build %%G.%%H {%%I %%J}")
)
del "%temp%\os.txt"

if not exist "%windir%\Microsoft.NET\Framework\v4.0.30319" goto :notinstalled

:menu
call :title
echo.
echo 1. Run full Ngen 'update' task
echo.
echo 2. Run standard Ngen 'update' task
echo.
echo 3. Execute queued Ngen items (what Windows does in background)
echo.
echo 4. Visit the 'homepage' of Burf:
echo    (http://1drv.ms/1oVTfju)
echo.
echo 5. Information
echo.
echo 6. Exit
echo.
echo. 
echo.
choice /c 123456 /N /M "Please enter your selection> "
if errorlevel 6 goto :eof
if errorlevel 5 goto :info
if errorlevel 4 start http://1drv.ms/1oVTfju&goto :menu
if errorlevel 3 goto :ngub
if errorlevel 2 goto :ngus
if errorlevel 1 goto :nguf


:info
call :title
echo This script allows your to easily run the .NET Framework tool Ngen
echo (Native Image Generator) program.
echo.
echo The three options in the menu represent the three different methods in
echo which is can be run:
echo Menu option 1 - Recreates all images
echo Menu option 2 - Processes images that have become invalid
echo Menu option 3 - Execute items already in queue to be processed by Windows
echo.
echo Option 1 is really only beneficial after a .NET Framework or a major Windows
echo update has been installed. Option 3 executes those items already in the
echo queue, this just processes the items immediately instead of during idle
echo processor time.
echo.
echo Option 2 should be used for general use, option 1 after a .NET Framework
echo or major Windows update (including Insider Previews), and option 3 is
echo only provided for completeness of this script. It is the 'least useful'.
echo.
echo It makes sense to have queued items processed and native images updated
echo before they are actually required!
echo.
echo.
echo Press any key to return to menu...
pause >nul
goto :menu


:nguf
call :title
echo Running x86 update item task. Some 'errors' may show, this is expected.
call :line
echo.
"%windir%\Microsoft.NET\Framework\v4.0.30319\ngen.exe" update /force
if defined task (
"%windir%\Microsoft.NET\Framework\v4.0.30319\ngentask.exe" /runtimewide
)
echo.
if %arch% equ x86 (goto :nudone)
echo.
echo Now running x64 update item task. Some 'errors' may show, this is expected.
call :line
echo.
"%windir%\Microsoft.NET\Framework64\v4.0.30319\ngen.exe" update /force
if defined task (
"%windir%\Microsoft.NET\Framework64\v4.0.30319\ngentask.exe" /runtimewide
)
goto :nudone


:ngus
call :title
echo Running x86 update item task. Some 'errors' may show, this is expected.
call :line
echo.
"%windir%\Microsoft.NET\Framework\v4.0.30319\ngen.exe" update
if defined task (
"%windir%\Microsoft.NET\Framework\v4.0.30319\ngentask.exe" /runtimewide
)


echo.
if %arch% equ x86 (goto :nudone)
echo.
echo Now running x64 update item task. Some 'errors' may show, this is expected.
call :line
echo.
"%windir%\Microsoft.NET\Framework64\v4.0.30319\ngen.exe" update
if defined task (
"%windir%\Microsoft.NET\Framework64\v4.0.30319\ngentask.exe" /runtimewide
)
goto :nudone


:ngub
call :title
echo Running x86 update item task. Some 'errors' may show, this is expected.
call :line
echo.
"%windir%\Microsoft.NET\Framework\v4.0.30319\ngen.exe" executequeueditems
if defined task (
"%windir%\Microsoft.NET\Framework\v4.0.30319\ngentask.exe" /runtimewide
)


echo.
if %arch% equ x86 (goto :nudone)
echo.
echo Now running x64 update item task. Some 'errors' may show, this is expected.
call :line
echo.
"%windir%\Microsoft.NET\Framework64\v4.0.30319\ngen.exe" executequeueditems
if defined task (
"%windir%\Microsoft.NET\Framework64\v4.0.30319\ngentask.exe" /runtimewide
)
goto :nudone


:nudone
echo.
echo.
echo Done! Please note that some 'errors' may have appeared. These are, for the
echo most part, not unexpected and are not deemed critical.
echo.
goto :fin


:title
cls
echo -----------------------------------------
echo Easy Ngen Runner v5 for '.NET 4.x' series by Burf
echo -----------------------------------------
echo %win%
echo.
goto :eof


:fin
echo.
echo Press any key to exit...
pause >nul
goto :eof


:notinstalled
echo Microsoft .NET Framework 4, 4.5, 4.6, or 4.7 NOT detected. Please install before
echo using this script. If already installed, something may be 'wrong'...
goto :fin


:line
echo ____________________________________________________________________________
goto :eof

답변2

레지스트리에서 키를 삭제하는 것이 마침내 나에게 도움이 되었습니다. 문제는 ngen이 레지스트리에 있는 동일한 손상된 DLL에 대해 계속해서 메모리를 재할당하려고 한다는 것입니다. 결국 컴퓨터에서 사용 가능한 메모리를 모두 소모하게 됩니다.

"\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\v2.0.50727\NGenService\Roots" 키를 삭제하면 나에게 도움이 되었습니다. 예약된 작업을 중지하거나 ngen.exe를 종료하는 것은 임시 조치일 뿐이며 문제를 해결하지 못합니다.

Microsoft가 어떻게 이와 같은 문제를 그렇게 오랫동안 방치할 수 있었는지 모르겠습니다. 오늘은 검색을 통해 답변을 얻은 첫 번째 날이었습니다.

문제에 대한 자세한 내용은 여기에서 확인할 수 있습니다.https://aloiskraus.wordpress.com/2017/12/13/the-case-of-ngen-exe-needing-50-gb-of-memory/

답변3

이것은 저에게 효과적이었습니다. 사람들이 온라인에서 말한 일을 한 후 바이러스 검사를 실행했는데 바로 캠이 돌아왔습니다. .netframework라는 이름의 .dll 파일 형식의 바이러스가 있었고, CPU 마이닝 바이러스인 것으로 밝혀졌습니다. 이것이 도움이 된다

관련 정보