I have web application on my IIS and weird things happen. After few days there is 4,5,6 or 7 w3wp.exe process started, and only one is working and the others are just sitting there and allocating 1GB+ memory each.
I'm unable to terminate this hanging processes:
C:\Users\administrator>taskkill /F /PID 5072 /T
ERROR: The process with PID 5072 (child process of PID 2988) could not be terminated.
Reason: Access is denied.
(pid: 2988 is svchost.exe)
It looks like IIS is unable to kill w3wp.exe process and just leaves it there. Only difference is that this web application is on Z:\ disk which is mounted NFS volume. Since this application is just communicating with SQL and save files to disk I presume some weird lock happens on NFS and process is left in some limbo state, other web apps that are on internal SSD RAID doing same thing are just fine.
Is there any way to terminate/kill such processes or find out what is causing this?

You could use below command to kill the worker process:
Note: run command prompt as administrator.
The "/f" is for "force".
also try to set the iis recycling application pool setting An application pool recycle is when all of the worker processes (w3wp.exe) for an application pool are unloaded and new instances are started to serve incoming requests.
https://learn.microsoft.com/en-us/iis/configuration/system.applicationhost/applicationpools/add/recycling/
another option is set iis application pool cpu usage setting:
Application pool worker processes that exceed their CPU limit will be forced to shut down.
https://learn.microsoft.com/en-us/iis/configuration/system.applicationHost/applicationPools/add/cpu
if you want to know the cause of the high memory usage then you could try to generate a memory dump file and debug&analyze the issue based on the dump.
https://learn.microsoft.com/en-us/sysinternals/downloads/procdump
https://www.microsoft.com/en-sg/download/details.aspx?id=49924
https://learn.microsoft.com/en-us/iis/troubleshoot/performance-issues/troubleshooting-high-cpu-in-an-iis-7x-application-pool