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:
- Check whether the application pool still has a worker process:
Replace%windir%\System32\inetsrv\appcmd.exe list wps /apppool.name:"YourAppPoolName"YourAppPoolNamewith the actual application pool name. - Check which process is using the gRPC port:
Replacenetstat -ano | findstr :<port><port>with the gRPC port number. If an entry appears in theLISTENINGstate, note its PID. - Identify the process associated with that PID:
Replacetasklist /FI "PID eq <PID>"<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.