KB 329065 Access Denied Error When You Make Code Modifications with Index Services Running

KB article 329065 describes how index services can affect ASP.NET.

The root cause of the problem is CreateFile flag FILE_SHARE_DELETE.

When the flag is specified, you will be able to delete the file, even it is in use by other applications. The problem is, when the file is deleted, and if other applications are still using this file, any furthur access to this file will result in access denied.

Back to ASP.NET, say index service decides to index ASP.NET's temporary files. Index services opens file with FILE_SHARE_DELETE flag. At the same time, if you change the ASP.NET page, or you touch web.config, ASP.NET will recompile the page for you. It does so by first deleting old compiled bits, then compile the page and copy to the temporary file folder. Since index services is touching files there, the first deletion succeeded, but it renders the file untouchable. Later when ASP.NET copies the newly compiled bits to the final location, it gets a access denied.

The “only” safe way to delete a file is to move it to a temporary location and delete from there, and never touch it again.

Comments (2)

  1. In my previous post I talked about how FILE_SHARE_DELETE can cause ERROR_ACCESS_DENIED error.


Skip to main content