Our ASP.NET web application uses Authorization manager. On a page of this web application, the authorization store which is a local XML file on the server is accessed many times to perform access check. Some clients of ours are getting a System.IO.FileLoadException
when they access this page. This is intermittent.
Stack trace:
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.IO.FileLoadException: The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020) at Microsoft.Interop.Security.AzRoles.AzAuthorizationStoreClass.Initialize(Int32 lFlags, String bstrPolicyURL, Object varReserved)
The process monitor shows a SHARING VIOLATION. I have searched for a solution, but could not find one. The client is on Windows Server 2003 SP2. So this hotfix http://support.microsoft.com/kb/919754 does not seem to apply because it is part of Windows Server 2003 SP2.
The code to access the authorization store is like this:
private IAzApplication2 AzmanApplication
{
get
{
AzAuthorizationStoreClass store = new AzAuthorizationStoreClass();
store.Initialize(0, _connectionString, null);
return store.OpenApplication2(_applicationName, null);
}
}
Anyone have any ideas how I could resolve this?