Problem with app pool

Михаил Андросов 486 Reputation points
2026-11-21T14:49:21.8566667+00:00

We are using Microsoft Windows Server 2012 R2.

The IIS application is running as a pool.

The app pool stops before updating. Sometimes there is a situation when the pool stops, but the task in the Task Manager remains hanging. When trying to remove it, the Access Denied error occurs.

I tried using the command
taskkill /F /PID
and remove the hung process. But an error occurs:

ERROR: The process with PID 7468 could not be terminated. Reason: There is no running instance of the task.

Typical of a zombie process.

When the pool starts, a new process is started. However, it does not work because the old hung process has occupied the grpc server port.

I don't know how to help the developers without restarting the server.

Windows development | Internet Information Services
0 comments No comments

2 answers

Sort by: Oldest
  1. AI answer

    2026-11-21T14:49:44.7366667+00:00

    The immediate path is to confirm whether the old IIS worker process is actually crashed, stuck during shutdown, or only appears as a stale PID.

    1. Check the real cause in Event Viewer.
      • On the server, open Run with Win+R, type eventvwr, and open Event Viewer.
      • In the Application log, look for:
        • Application Error, Event ID 1000
        • .NET Runtime, Event ID 1026
      • For IIS worker process failures, focus on w3wp.exe as the faulting application.
      • Record the Faulting module name and Exception code.
    2. Interpret the exception code.
      • 0xC0000005: access violation.
      • 0xe0434352: unhandled CLR exception in application code. Check the matching .NET Runtime 1026 event details, especially Description and Exception Info.
      • 0xC00000fd: stack overflow, commonly caused by infinite recursion.
    3. Capture a dump of the affected w3wp.exe instead of trying to force-kill it repeatedly.
      • This is the most useful way to help developers identify why the old process is hanging onto the gRPC port.
      • Safer options from the documented workflow are:
        • Windows Error Reporting (WER) first
        • Debug Diagnostic Tool
        • ProcDump
    4. Start with WER.
      • Check Event Viewer for Windows Error Reporting events.
      • Look in the directories named in those events for .mdmp or .hdmp files.
      • If dumps already exist, provide them to the developers or support.
      • If not, configure HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps with:
        • DumpFolder = path on a non-system drive with enough space
        • DumpCount = 3
        • DumpType = 2 for a full dump
      • Warning: registry changes are risky. Back up the relevant key first and use a non-system drive for dump storage.
    5. If the problem must be reproduced, use ProcDump on the IIS worker process.
      • Download ProcDump.
      • Extract it to a folder on a drive other than the system drive.
      • Open Command Prompt as administrator.
      • In IIS Manager:
        • select the server
        • open Worker Processes
        • note the PID for the affected w3wp.exe
      • Run:
             procdump -ma -e 1 -f "<typeOfException>" PID
        
      • -ma captures a full dump, -e 1 captures on first exception, and -f filters by exception type.
    6. If the issue happens during app pool shutdown, check shutdown timing.
      • IIS application pools need time to finish in-flight requests during shutdown.
      • If ShutdownTimeLimit was reduced too far from the default 90 seconds, IIS can log shutdown-related warnings and the pool may not stop cleanly under load.
      • If long-running requests are expected, increase ShutdownTimeLimit and capture a dump of w3wp.exe while the shutdown problem is occurring.
    7. About taskkill reporting “process not found”.
      • On Windows Server 2012 / 2012 R2 under heavy load, Taskkill.exe /PID <pid> can fail with:
        • ERROR: The process "<pid>" not found.
      • That behavior is documented, so this result alone does not prove the process is gone cleanly.
    8. After a dump is collected, analyze it.
      • Open DebugDiag2 Analysis.
      • Use Add Data Files to load the dump.
      • Run Start Analysis.
      • In the report:
        • for 0xC0000005, find the failing call stack and identify application code
        • for 0xC00000fd, look for repeating functions indicating recursion
        • for 0xe0434352, identify the call stack returning the application exception

    This gives developers actionable evidence without immediately restarting the server. The key step is collecting a dump from the hung or crashing w3wp.exe and correlating it with Application Error 1000 / .NET Runtime 1026 events.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

  2. Tom Tran (WICLOUD CORPORATION) 5,970 Reputation points Microsoft External Staff Moderator
    2026-11-23T03:09:19.0333333+00:00

    Hi @Михаил Андросов ,

    I would start by checking which process is still holding the gRPC port after the application pool stops. This should help determine whether the port is being held by the IIS worker process or another process started by the application.

    When the issue happens again, please open Command Prompt as an administrator and try the following:

    1. Check whether the application pool still has a worker process:
         %windir%\System32\inetsrv\appcmd.exe list wps /apppool.name:"YourAppPoolName"
      
      Replace YourAppPoolName with the actual application pool name.
    2. Check which process is using the gRPC port:
         netstat -ano | findstr :<port>
      
      Replace <port> with the gRPC port number. If an entry appears in the LISTENING state, note its PID.
    3. Identify the process associated with that PID:
         tasklist /FI "PID eq <PID>"
      
      Replace <PID> with the process ID from the previous command.

    If a separate application or service is holding the port, it may be possible to stop that component independently without restarting the server.

    I would also suggest checking Event Viewer > Windows Logs > System for Windows Process Activation Service (WAS) warnings around the time the application pool stops, particularly Event ID 5013. This event can indicate that an IIS worker process exceeded its shutdown time limit. Microsoft provides more details in An application pool exceeds time limits during shutdown in IIS.

    Could you share the output of these commands after the application pool stops, particularly the process that remains in the LISTENING state? Please also let me know whether the gRPC server runs within the IIS worker process or as a separate process.

    If you found my response helpful or informative, I would greatly appreciate it if you could follow this guidance for your confirmation. Thank you.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.