asp.net – COMException未知错误(0x80005000) – DirectoryServ
发布时间:2020-12-16 07:41:03 所属栏目:asp.Net 来源:网络整理
导读:我在我的一个应用程序上遇到错误,每个月发生几次,但本周发生了两次.当这种情况发生时,第一个用户加载应用程序并开始工作时,它总是第一件事(Web应用程序,3-4个内部用户)错误源于这个非常简单的方法,一旦失败,它将无法工作,直到我重启应用程序池.现在,我也以其
我在我的一个应用程序上遇到错误,每个月发生几次,但本周发生了两次.当这种情况发生时,第一个用户加载应用程序并开始工作时,它总是第一件事(Web应用程序,3-4个内部用户)错误源于这个非常简单的方法,一旦失败,它将无法工作,直到我重启应用程序池.现在,我也以其他方式查询AD,但这是用户在早上开始工作时调用的第一个AD相关方法.
public DomainUser GetDomainUser(string userLoginName) { using (PrincipalContext context = new PrincipalContext(ContextType.Domain,this.DomainName)) { using (UserPrincipal user = UserPrincipal.FindByIdentity(context,userLoginName)) { // If user is null,the result is not a UserPrinciple if (user != null) { string firstName = user.GivenName; string middleName = user.MiddleName; string lastName = user.Surname; int empId = Convert.ToInt32(user.EmployeeId); string emailAddr = user.EmailAddress; string userName = user.SamAccountName; DateTime? accountExp = user.AccountExpirationDate; return new DomainUser { FirstName = firstName,MiddleName = middleName,LastName = lastName,EmployeeId = empId,Email = emailAddr,UserName = userName,AccountExpiration = accountExp }; } return null; } } } 因此,this问题密切相关,但我的权限设置正确,代码在99%的时间内正常工作,并将在应用程序池重新启动后继续运行. 堆栈跟踪看起来像这样: System.Runtime.InteropServices.COMException (0x80005000): Unknown error (0x80005000) at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_AdsObject() at System.DirectoryServices.PropertyValueCollection.PopulateList() at System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry,String propertyName) at System.DirectoryServices.PropertyCollection.get_Item(String propertyName) at System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInitNoContainer() at System.DirectoryServices.AccountManagement.PrincipalContext.DoDomainInit() at System.DirectoryServices.AccountManagement.PrincipalContext.Initialize() at System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx() at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext context,Type principalType,Nullable`1 identityType,String identityValue,DateTime refDate) at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithType(PrincipalContext context,String identityValue) at System.DirectoryServices.AccountManagement.UserPrincipal.FindByIdentity(PrincipalContext context,String identityValue) at ADWrapper.AdSearch.GetDomainUser(String userLoginName) 问题是什么?内存泄漏?常见的模式是,当第一个用户开始使用应用程序时,这首先发生在早上. 解决方法
很长一段时间我一直在努力解决同样的问题.我的解决方案实际上是安装功能IIS 6 Metabase Compatiblity.之后没有问题.一些帮助我的文章在下面
http://blogs.msdn.com/b/jpsanders/archive/2009/05/13/iis-7-adsi-error-system-runtime-interopservices-comexception-0x80005000-unknown-error-0x80005000.aspx http://michaelwasham.com/2011/04/25/annoying-error-using-system-directoryservices-and-iis-app-pools/ (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net – 如何在我的自定义MvcRouteHandler中模拟IgnoreR
- 在基本控制器中覆盖ASP.NET MVC中的OnAuthorization
- .net – 当表中的数据发生变化时,SqlCacheDependency如何知
- asp.net – Aspnet网站管理工具,Users表或aspnet_users表
- Asp.Net 文件操作基类(读取,删除,批量拷贝,删除,写入,获取文
- ASP.Net应用程序的最佳菜单是什么?
- asp.net-mvc – ASP.NET在基本控制器中重定向
- asp.net – 诸如Eval(),XPath()和Bind()的数据绑定方法只能
- asp.net – 在MVC 3中的url中传递多个参数
- asp.net – 从下拉列表中选择OBJECT的问题
推荐文章
站长推荐
- asp.net – 将HTML表导出到Excel
- ASP.NET MVC是一个大的企业项目的不好的选择吗?
- asp.net-mvc-4 – 在一个项目中混合Web Api和ASP
- asp.net-mvc – 发送asp.net mvc动作结果里面的电
- asp.net-mvc – 使用ASP.NET MVC3进行客户端模型
- asp.net mvc 之旅 —— 第五站 从源码中分析asp
- asp.net-mvc – 在同一页面显示搜索表单及其结果
- asp.net – 在2K3构建服务器上的单元测试中不允许
- asp.net-mvc – 用于测试目的的假开放ID提供程序
- asp.net-mvc-3 – Razor查看if语句是否正确
热点阅读