locked
Unknown error (0x80005000) System.DirectoryServices occurring randomly RRS feed

  • Question

  • User-2021021808 posted

    We have a web application that connect to the domain server and check if the domain account is valid. In most cases it runs well. However, it doesn't work by chance (about once per month in the last four months). The error message from domain server is:  Unknown error (0x80005000). It works again after we restart IIS manually. Please let me know what is the solution to fix the issue.

    It is the same issue as the post https://forums.asp.net/t/1862718.aspx , but there's no solution in the post.

     [Server environment]: Windows Server 2012 R2 Data Center

     

    :

            public static bool CheckLdapConnect(DomainInfo domainInfo)

            {

                bool success = false;

                if (domainInfo.DomainUserName == null)

                    return false;

                string adPath = "LDAP://" + domainInfo.Server + ":" + domainInfo.Port.ToString().Trim()

                    + string.Format("/DC={0}", domainInfo.Domain.Replace(".", ",DC="));

                string domainAndUsername = domainInfo.DomainUserName;

                if (!domainInfo.DomainUserName.Contains(@"\") && !domainInfo.DomainUserName.Contains("@"))

                    domainAndUsername = domainInfo.Domain + @"\" + domainAndUsername;

                DirectoryEntry deTest = new DirectoryEntry(adPath, domainAndUsername, domainInfo.DomainPassword);

                deTest.AuthenticationType = AuthenticationTypes.ReadonlyServer  | AuthenticationTypes.Secure | AuthenticationTypes.Sealing | AuthenticationTypes.ServerBind;

                 try

                {

                    string dcName = deTest.Name;

                    success = true;

                }

                catch (Exception ex)

                {

                    Logger.WriteLine(CIPACE.DateTimeUtility.Now.ToString("MM/dd/yyyy hh:mm:ss") + " " + ex.Message);

                }

                finally

                {

                    deTest.Close();

                    deTest.Dispose();

                }

                 return success;

            }

     

        public partial class DomainInfo : ModelBase

        {

            public const int LDAP_DEFAULT_PORT = 389;

            public string Server;    //Domain server

            public string Domain;    //Domain name

            public int Port;         //LDAP Port

            public string DomainUserName;    //Domain user name

            public string DomainPassword     //Domain user password

        }

    Wednesday, November 28, 2018 10:21 AM

All replies

  • User-1492487179 posted

    Hi borelli,

    Based on your description, this issue occurs once a month. And it will work if we restart IIS. If we recycle this site, does it work? Is it possible to access other pages? How many user will access this site per day? Do you find CPU or memory problem at that time? Is there any law when the problem is reproduced?  You can also check your event log (system & Application) to see whether there are some related logs about this issue. And it will helpful if you write more logs in your code.

    Regards

     

    Friday, November 30, 2018 6:55 AM