azman - Microsoft.Interop.Security.AzRoles.AzAuthorizationStoreClass.Initialize 因 System.IO.FileLoadException 而失败

标签 azman fileloadexception

我们的 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/

相关文章:

c# - 使用授权管理器 (AzMan) 获取属于某个角色的用户列表

c# - 尝试访问已卸载的应用程序域(调用 AzMan)

c# - WPF 应用程序 - 角色管理建议

c# - DLL 加载时出现 FileLoadException

.net - Word VSTO 4.0 插件无法加载 : Could not load file or assembly

c# - 'Microsoft.Owin' 上的 FileLoadException

.net - 找到的程序集的 list 定义与程序集引用不匹配

c# - 为什么我在调用 AzMan 时收到错误 "Unable to update the password"?

.net - .Net 上的授权和权利解决方案,就像之前在 AzMan 中一样