locked
A local error has occurred (formatting fixed) RRS feed

  • Question

  • User-968139384 posted

    I'm making an intranet webapplication in ASP.NET, using Windows auth and accessing Active Directory using the LDAP-pattern found in one of the stickies on top of the LDAP-threads-list here on forums.asp.net.

    public static DataSet FindUsers(string sFilter, string[] columns, string path, bool useCached);

    I've got a domain controller installed by my side, and using the following in a test-application:

    string filter = "(objectClass=*)";
    string[] columns = new string[]{"sn", "sAMAccountName", "cn"};
    string path = "LDAP://<IPADDR>/<DCTHISDCTHAT>"; DataSet ds = FindUsers(filter, columns, path, false);
    dataGridView1.DataSource = ds; dataGridView1.AutoGenerateColumns = true;
    dataGridView1.DataMember = ds.Tables[0].ToString();

    I fetch stuff easily, and the DataGridView is filled with it. Nice. BUT. Even if it works right now, tomorrow, or after some amount of hours (not sure how many though), I get DirectoryServicesCOMException thrown at me, saying:

    "A local error has occurred.". It's triggered by the DirectorySearcher.FindAll()-function. Since it's working now, I don't have the exact output in front of me. Google gives me nada on the specific error message, and I get the error message in both my web app and the test-app I mentioned above.

    Anyone with experiences on this? I've set up the domain controller myself, and started wondering if THAT is a potential error source.

    Thanks in advance, Anders Øyvind

    Tuesday, July 3, 2007 10:50 AM

Answers

  • User-934909271 posted

    I had this problem today when trying to access a windows 2003 AD domain from my vb.net app and this page was pretty much the only thing I found on google when searching for a solution. I eventually found a solution myself so thought I would post it just in case it helps anyone else. The way I got it working was to define the Authentication Type of the DirectoryEntry object as Secure. So for example, instead of this:

    Dim MyUserDE As New DirectoryEntry(ldappath)

    I now do this:

    Dim MyUserDE As New DirectoryEntry(ldappath, username, password, AuthenticationTypes.Secure)

     

    Hope that helps someone out.

    Chris

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, December 1, 2008 5:25 AM
  • User46080679 posted

    One potential reason would be that the accound that the membership provider is running on is locked. Unlock the user, and you should be fine.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 25, 2009 11:55 AM
  • User-337472979 posted

    Just FYI, I had this "local error" in a one-way trust dev environment: I was trying to search - using FindOne() - for a user in the downstream domain.

    I fixed this by ensuring the upstream server's primary DNS was pointing to its own domain and the alternate DNS was pointing to the downstream domain.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 27, 2009 9:10 PM

All replies

  • User-968139384 posted

    Expanding the error description, in case someone notice something familiar:

    System.DirectoryServices.DirectoryServicesCOMException was unhandled by user code<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>  Message="A local error has occurred.\r\n"<o:p></o:p>  Source="System.DirectoryServices"<o:p></o:p>  ErrorCode=-2147016645<o:p></o:p>  ExtendedError=-2146893052<o:p></o:p>  ExtendedErrorMessage=""<o:p></o:p>  StackTrace:<o:p></o:p>       at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)<o:p></o:p>       at System.DirectoryServices.DirectoryEntry.Bind()<o:p></o:p>       at System.DirectoryServices.DirectoryEntry.get_AdsObject()<o:p></o:p>       at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne)<o:p></o:p>

           at System.DirectoryServices.DirectorySearcher.FindAll()

    <o:p>       etc...</o:p><o:p> </o:p><o:p>ExtendedError gave a friend of mine the idea of System Error 772 :ERROR_ROWSNOTRELEASED - The data provider requires that previously fetched data is released before asking for more data.</o:p><o:p> </o:p><o:p>I've inserted a dispose on the DirectorySearcher, but the error occurred once again just now. </o:p><o:p> </o:p><o:p>In addition to the use of the DirectoryServices framework, I use System.Web.Security.ActiveDirectoryMembershipProvider to provide windows authentication to my web application. The following defines my setup in web.config. </o:p><o:p> </o:p><o:p>

    <membership defaultProvider="ADMembershipProvider">
    <
    providers>
    <
    clear/>
    <
    add name="ADMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ActiveDirectory"/>
    </
    providers>
    </
    membership>

    The connectionString-name is pointing to an LDAP-connectionString defined under the connectionStrings section of the web.config.

    It really bothers me that I have to reset my computer every hour, so any tip is appreciated ofcourse.

    Anders Ø

    </o:p>
    Wednesday, July 4, 2007 8:24 AM
  • User1759355572 posted

     Hi,

    I'm getting exactly the same error. Have you figured out how to resolve the issue?

    Tuesday, November 25, 2008 2:21 PM
  • User-934909271 posted

    I had this problem today when trying to access a windows 2003 AD domain from my vb.net app and this page was pretty much the only thing I found on google when searching for a solution. I eventually found a solution myself so thought I would post it just in case it helps anyone else. The way I got it working was to define the Authentication Type of the DirectoryEntry object as Secure. So for example, instead of this:

    Dim MyUserDE As New DirectoryEntry(ldappath)

    I now do this:

    Dim MyUserDE As New DirectoryEntry(ldappath, username, password, AuthenticationTypes.Secure)

     

    Hope that helps someone out.

    Chris

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, December 1, 2008 5:25 AM
  • User46080679 posted

    One potential reason would be that the accound that the membership provider is running on is locked. Unlock the user, and you should be fine.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 25, 2009 11:55 AM
  • User1048150143 posted

    Thanks for the tip.  I have a windows application which was giving me a System.DirectoryServices.DirectoryServicesCOMException of "A local error has occurred" this was due to the user account under which the application was running being locked.

    Wednesday, August 26, 2009 8:57 AM
  • User-337472979 posted

    Just FYI, I had this "local error" in a one-way trust dev environment: I was trying to search - using FindOne() - for a user in the downstream domain.

    I fixed this by ensuring the upstream server's primary DNS was pointing to its own domain and the alternate DNS was pointing to the downstream domain.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 27, 2009 9:10 PM
  • User-612201841 posted

    Hi,

    I am facing the same problem.From time to time "a local error has occurred" is showing and once it occurs

    my application can't connect any more to the ActiveDirectory so I should recycle the pool.

    Unfortunately, I couldn't understand the proposed solution for the locked users.

    How can I check does a user is locked, and who has  locked it ?

    Wednesday, June 30, 2010 6:33 AM