我们的 ASP.NET Web 应用程序使用授权管理器。在此Web应用程序的页面上,授权存储是服务器上的本地XML文件,它被多次访问以执行访问检查。我们的一些客户在访问此页面时收到 System.IO.FileLoadException
。这是间歇性的。
堆栈跟踪:
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)
进程监视器显示共享违规。我已经搜索了解决方案,但找不到。客户端在 Windows Server 2003 SP2 上。所以这个修补程序 http://support.microsoft.com/kb/919754似乎不适用,因为它是 Windows Server 2003 SP2 的一部分。
访问授权存储的代码是这样的:
private IAzApplication2 AzmanApplication
{
get
{
AzAuthorizationStoreClass store = new AzAuthorizationStoreClass();
store.Initialize(0, _connectionString, null);
return store.OpenApplication2(_applicationName, null);
}
}
有人知道我该如何解决这个问题吗?
最佳答案
这意味着该文件(可能是您拥有的 AzMan 的 XML 文件)在另一个应用程序中打开。 确保 azman.mmc 没有运行,让这个商店打开以进行编辑/审查等。
关于azman - Microsoft.Interop.Security.AzRoles.AzAuthorizationStoreClass.Initialize 因 System.IO.FileLoadException 而失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13822408/