This is a quick-tip on how to kill the .NET worker process. Often when I’m developing web applications I’ll run into an issue where I’ve made a change but it’s not being reflected when I’m running or debugging the software. I’ll clear the browser cache and even restart my debugging session, but still the previous version persists. This can be an issue where the web server or caching mechanism are caching the results. There are numerous other issues that can be resolved by a restart of the .NET worker process.
I’ve found that the quickest way to get around this and other issues related to the .NET worker process, is to simply stop debugging, kill the process and then start debugging again. This causes it to reload the app domain, load fresh data into cache, etc. Here’s how you can do it.
Kill the .NET Worker Process
- Open a command prompt via whatever means your version of Windows requires.
- Click on Start -> Run -> Type “CMD” -> Click OK.
- Click on Start -> Type “CMD” in Textbox -> Press Enter.
- At the command prompt type “taskkill /IM w3wp.exe /F”.
- Press Enter.
Here is what’s happening in the taskkill program.
- taskkill – This launches the taskkill application which allows you to terminate tasks by process id (PID) or image name.
- /IM – This tells taskkill to search for a process by image name instead of process id (PID).
- w3wp.exe – This is the image name we want to terminate. It’s the WWW Worker Process or .NET Worker Process.
- /F – This tells taskkill to force terminate the process since it may be in use, stalled or otherwise unable to terminate on request.
I simply put this entire command in a shortcut which I keep in my handy list of developer tools folder in my favorites (yes you can keep program shortcuts in your favorites). Then I show my “Links” folder on my task bar by right-clicking my task bar (bottom bar in Windows), selecting Toolbars and then ensuring Links is selected. This causes all of my favorites to be in a small folder that opens upwards when I click on it, making all of my most used programs, web sites, folders, etc. within easy reach.
I hope this helps!