[英]Error 0x5011 in .NET3.5 c# using IIS7 and Windows Server
I am new to .NET development, usually working as a DBA. 我是.NET开发的新手,通常是DBA。
I have developed a website in .NET 3.5 using c#. 我已经使用C#在.NET 3.5中开发了一个网站。 This website is for querying a database with password information. 该网站用于查询带有密码信息的数据库。 I believe the error lies in my IIS settings or my web.config file, not my c# code however I may be wrong. 我相信错误在于我的IIS设置或web.config文件,而不是我的C#代码,但是我可能是错的。
I get the error: 我收到错误:
Unknown error (0x5011)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Unknown error (0x5011)
Line 40: UserPrincipal user = UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, VerifiedUser);
Line 41:
Line 42: foreach (var group in user.GetGroups())
Line 43: {
Line 44:
Stack Trace:
[COMException (0x5011): Unknown error (0x5011)]
System.DirectoryServices.ResultsEnumerator.MoveNext() +437216
System.DirectoryServices.AccountManagement.ADDNLinkedAttrSet.GetNextSearchResult() +195
System.DirectoryServices.AccountManagement.ADDNLinkedAttrSet.MoveNextMemberSearcher() +57
System.DirectoryServices.AccountManagement.ADDNLinkedAttrSet.MoveNext() +102
System.DirectoryServices.AccountManagement.ADDNConstraintLinkedAttrSet.MoveNext() +55
System.DirectoryServices.AccountManagement.FindResultEnumerator`1.MoveNext() +106
System.DirectoryServices.AccountManagement.FindResultEnumerator`1.System.Collections.IEnumerator.MoveNext() +9
_Default.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\PasswordVault\Default.aspx.cs:42
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
System.Web.UI.Control.OnLoad(EventArgs e) +132
System.Web.UI.Control.LoadRecursive() +66
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428
It always works fine on my local machine (windows 7) however when I transfer to Windows Server 2008 using IIS 7 and store the files in wwwroot folder of inetpub, I get this intermitent error. 它始终在我的本地计算机(Windows 7)上正常运行,但是当我使用IIS 7传输到Windows Server 2008并将文件存储在inetpub的wwwroot文件夹中时,出现此间歇性错误。
I have the error today, but not yesterday but it was there the previous day. 我今天有错误,但昨天没有,但前一天有错误。 I have spent hours tinkering with IIS settings and the app pools but would really need to know what is causing the problem. 我花了几个小时来修改IIS设置和应用程序池,但实际上需要知道是什么引起了问题。
The code which is doesn't like is checking if the user is a member of a specific AD group and if so, returning information based on that user's group. 不喜欢的代码是检查用户是否是特定AD组的成员,如果是,则根据该用户组返回信息。 I don't believe the code is an issue as it does work (sometimes) and always on my local machine. 我不认为代码是一个问题,因为它确实可以工作(有时)并且始终在我的本地计算机上。 I believe this issue is with IIS or .NET framework. 我认为此问题与IIS或.NET框架有关。
Any help would be really appreciated. 任何帮助将非常感激。
Regards John 问候约翰
This is a problem in the 3.5 library. 这是3.5库中的问题。 Here is a code around and description of the problem: http://blogs.msdn.com/b/dsadsi/archive/2010/12/14/title-system-directoryservices-accountmanagetment-userprincipal-getgroups-will-throws-comexception-error-0x5011-s-ads-errorsoccurred-while-enumerating-the-principalsearchresult-collection.aspx 以下是有关该问题的代码和说明: http : //blogs.msdn.com/b/dsadsi/archive/2010/12/14/title-system-directoryservices-accountmanagetment-userprincipal-getgroups-will-throws-comexception枚举principalsearchresult-collection.aspx时发生错误0x5011-s-ads错误
Here is a possible answer: Unknown error (0x5011) with ActiveDirectory PrincipalContext . 这是一个可能的答案: ActiveDirectory PrincipalContext发生未知错误(0x5011) 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.