I’ve got a windows service that relies on a DLL. Whether the service is running or not, its executable is keeping a handle to that DLL, which is preventing me from updating it automatically.
Why is this, and how can I remove that handle programatically (preferably via .Net)?
Update:
I know that the service’s executable is the one with the handle because I ran handle.exe on the dll and only the service’s exe came up. Nothing cane up when I ran it on the exe and I know that the service isn’t running because I checked the services list. There is nothing else that would be using the dll that I can think of.
This was a nasty little problem. The service has two threads, and one of them performs a very subtle, not frequently needed function, and I did not notice that it was getting deadlocked over a shared resource. So it was hanging, indefinitely, which is what was keeping my executable engaged, despite the service being shut down. Fixing that issue resolved my file handle issue.
Thanks for the suggestions, all.