I'm developing an app that listens on port 3000. Apparently there's an instance of it still listening to the port because whenever I start it, it can't create a listener (C#, TcpListener, but that's irrelevant) because the port is already taken.
Now, the app doesn't exist in the Task Manager, so I tried to find its PID and kill it, which led to this interesting result:
C:\Users\username>netstat -o -n -a | findstr 0.0:3000 TCP 0.0.0.0:3000 0.0.0.0:0 LISTENING 3116 C:\Users\username>taskkill /F /PID 3116 ERROR: The process "3116" not found.
I haven't seen this behaviour before and figured it was interesting enough to see if anyone has a solution.
UPDATE: I started up Process Explorer and did a search for 3000 and found this:
<Non-existent Process>(3000): 5552
I right clicked on it and chose "Close Handle". It's no longer in Process Explorer, but still shows up in netstat and still stops the app from starting the listener.
UPDATE 2: Found TCPView for Windows which show the process as
"<non-existent>". Like with CurrPorts, nothing happens when I try to close the connection in this tool.