Craig Marvelley

Software and such

IIS File Locking

This issue has bitten me so many times I’m going to document it here so hopefully I’ll remember it in future. Now and then, when deleting files using Windows Explorer, random files would fail an access check even though I’m the system administrator. Unlocker reported no locks on the file, but it wouldn’t let me delete it either. The only way I could get around it was a restart.

This got annoying so the next time it happened I started shutting down all my running programmes one by one and retrying the delete, until I discovered that it was in fact IIS that was causing the lock – even though the files weren’t web accessible. Turning off the webserver was enough to allow the files to be deleted.