Facing problem while accessing data from Active Directory
-
Hi all, One Page of my ASP.NET application uses an active directory search to fetch the list of users. The Problem is : This page works fine all day long but sometimes throws an error "The server is not operational". This error disappears when the IIS is reset, but appears again after 2 or 3 hrs.I am unable to find out the reason behind this.I am sending you the details I found in the event Viewer: Event code: 3005 Event message: An unhandled exception has occurred. Event time: 4/15/2009 6:23:17 AM Event time (UTC): 4/15/2009 1:23:17 PM Event ID: dbd99a355e4f451da4fd7e4f50e0f8e1 Event sequence: 21 Event occurrence: 6 Event detail code: 0 Application information: Application domain: /LM/W3SVC/399023246/Root/Mail-14-128842748654050392 Trust level: Full Application Virtual Path: /Mail Application Path: C:\Inetpub\wwwroot\EnhancementSite\Mail on myip\ Machine name: mymachinename Process information: Process ID: 2380 Process name: w3wp.exe Account name: NT AUTHORITY\NETWORK SERVICE Exception information: Exception type: COMException Exception message: The server is not operational. Request information: Request URL: http://mydomain.com/Mail/newmail.aspx Request path: /Mail/newmail.aspx User host address: mydomain.com User: username Is authenticated: True Authentication Type: NTLM Thread account name: NT AUTHORITY\NETWORK SERVICE Thread information: Thread ID: 5 Thread account name: NT AUTHORITY\NETWORK SERVICE Is impersonating: False Stack trace: at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_AdsObject() at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne) at System.DirectoryServices.DirectorySearcher.FindAll() at GetAllUsers.getUsers.getUsername(DropDownList dduserlist) at Mail.newmail.Page_Load(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) kindly help me find a permanent solution to this problem as iisreset is not a very good option. Thanks Vasillis_zayetsav
-
Hi all, One Page of my ASP.NET application uses an active directory search to fetch the list of users. The Problem is : This page works fine all day long but sometimes throws an error "The server is not operational". This error disappears when the IIS is reset, but appears again after 2 or 3 hrs.I am unable to find out the reason behind this.I am sending you the details I found in the event Viewer: Event code: 3005 Event message: An unhandled exception has occurred. Event time: 4/15/2009 6:23:17 AM Event time (UTC): 4/15/2009 1:23:17 PM Event ID: dbd99a355e4f451da4fd7e4f50e0f8e1 Event sequence: 21 Event occurrence: 6 Event detail code: 0 Application information: Application domain: /LM/W3SVC/399023246/Root/Mail-14-128842748654050392 Trust level: Full Application Virtual Path: /Mail Application Path: C:\Inetpub\wwwroot\EnhancementSite\Mail on myip\ Machine name: mymachinename Process information: Process ID: 2380 Process name: w3wp.exe Account name: NT AUTHORITY\NETWORK SERVICE Exception information: Exception type: COMException Exception message: The server is not operational. Request information: Request URL: http://mydomain.com/Mail/newmail.aspx Request path: /Mail/newmail.aspx User host address: mydomain.com User: username Is authenticated: True Authentication Type: NTLM Thread account name: NT AUTHORITY\NETWORK SERVICE Thread information: Thread ID: 5 Thread account name: NT AUTHORITY\NETWORK SERVICE Is impersonating: False Stack trace: at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_AdsObject() at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne) at System.DirectoryServices.DirectorySearcher.FindAll() at GetAllUsers.getUsers.getUsername(DropDownList dduserlist) at Mail.newmail.Page_Load(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) kindly help me find a permanent solution to this problem as iisreset is not a very good option. Thanks Vasillis_zayetsav
Try this... Replace the values for user and active directory group. DirectoryEntry ent = new DirectoryEntry(appSettings.domain, appSettings.user, appSettings.password, AuthenticationTypes.ReadonlyServer); DirectorySearcher srch = new DirectorySearcher(ent, "(CN=" + activeDirectoryGroup + ")"); SearchResult obj = srch.FindOne(); DirectoryEntry dr = new DirectoryEntry(obj.Path, appSettings.user, appSettings.password); foreach (object ob in (IEnumerable)dr.Invoke("members")) { DirectoryEntry obGpEntry = new DirectoryEntry(ob); //Put your code here. }
I didn't get any requirements for the signature