none
“Unknown error (0x8000500c)” is thrown when accessing Active Directory RRS feed

  • Question

  • A WCF(.NET 3.5) service runs on IIS 7 in "domain1". The service runs under a domain user account from trusted domain "domain 2". The service is running on a different machine(virtual machine) from the machine(virtual machine) where "domain1" Domain Controller is running. The service was working properly in the production and then suddenly the following exception was thrown.

    Message: Unknown error (0x8000500c)System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: Unknown error (0x8000500c) (Fault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is: System.Runtime.InteropServices.COMException: Unknown error (0x8000500c)

    The above error was thrown by the following code:

    private bool IsActiveDirectoryUser(string userName)
            {
                bool isActive = false;
                string[] userNameInfo = userName.Split(new char[] { '\\' });
                if (userNameInfo != null && userNameInfo.Length == 2)
                {
                    string domainName = userNameInfo[0];
                    string winName = userNameInfo[1];
                    PrincipalContext principalContext = new PrincipalContext(ContextType.Domain, domainName);
                    PrincipalSearcher principalSearcher = null;
                    {
                        UserPrincipal userPrincipal = new UserPrincipal(principalContext);
                        userPrincipal.SamAccountName = winName;
                        principalSearcher = new PrincipalSearcher(userPrincipal);
                        Principal principalUser = principalSearcher.FindOne();
                        if (principalUser != null)
                        {
                            UserPrincipal validUser = ((UserPrincipal)principalUser);
                            if ((validUser.Enabled != null && validUser.Enabled.Value) && !validUser.IsAccountLockedOut())
                                isActive = true;
                        }                    
                    }
                }
                return isActive;
            } 

    After restarting the service the exception was gone. I've tried to reproduce the error in the development environment but in vain. The online resources suggest two possible scenarios for generating 0x8000500c error:

    1. Accessing custom active directory attribute. I don't use this

    2. Problem with AD cashing. If this was the problem why the exception was gone after restarting the service. One would expect cache to be cleared after machine restarting not process restarting.

    Any ideas on how to reproduce the error? Thanks!!


    • Moved by Kristin Xie Monday, August 24, 2015 5:32 AM move to appropriate forum
    Friday, August 21, 2015 2:17 AM

Answers

  • One would expect cache to be cleared after machine restarting not process restarting.

    If it was catastrophic enough, the WCF Web service could have crashed the Wpw3.exe, the ASP.NET Worker Process, that  was hosting the WCF service, and everything is lost. IIS would have restarted the Application Pool that hosts the WCF service that the WpW3.exe serviced. Everything is reset and ready to go as if nothing happened, and the WCF Web service is setting there listening for inbound traffic and ready to go.

    https://msdn.microsoft.com/en-us/library/ms734710%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396

    Friday, August 21, 2015 2:37 AM

All replies

  • One would expect cache to be cleared after machine restarting not process restarting.

    If it was catastrophic enough, the WCF Web service could have crashed the Wpw3.exe, the ASP.NET Worker Process, that  was hosting the WCF service, and everything is lost. IIS would have restarted the Application Pool that hosts the WCF service that the WpW3.exe serviced. Everything is reset and ready to go as if nothing happened, and the WCF Web service is setting there listening for inbound traffic and ready to go.

    https://msdn.microsoft.com/en-us/library/ms734710%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396

    Friday, August 21, 2015 2:37 AM
  • Yes I understand what you are talking about. It seems that error was not catastrophic enough.
    Friday, August 21, 2015 8:12 AM
  • Yes I understand what you are talking about. It seems that error was not catastrophic enough.

    IIS has the control and the final say,  and it did what it wanted to do.
    Friday, August 21, 2015 2:08 PM