简体   繁体   中英

Error 0x5011 in .NET3.5 c# using IIS7 and Windows Server

I am new to .NET development, usually working as a DBA.

I have developed a website in .NET 3.5 using c#. 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.

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.

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.

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. 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.

Any help would be really appreciated.

Regards John

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM