Page view counter

The server is not operational.

Last post 06-17-2008 4:28 PM by KentZhou. 3 replies.

Sort Posts:

  • The server is not operational.

    06-17-2008, 12:19 PM
    • Loading...
    • KentZhou
    • Joined on 05-03-2006, 11:48 AM
    • Posts 540
    • Points 1,006

    I have a testing code for AD. It works fine for a while. But next day I run it again and got the error

    An exception of type 'System.Runtime.InteropServices.COMException' occurred in System.DirectoryServices.dll but was not handled in user code

    The server is not operational.

     

    What's the possible reason? The code is copied from this forum as below:

        Dim context As HttpContext = HttpContext.Current
        Dim userDS As DataSet = CType(context.Cache(sFilter), DataSet) 

                If (userDS Is Nothing) Or Not useCached Then
                    Dim deParent As DirectoryEntry = New DirectoryEntry(path)    '''Actually, the error caused at this line
                    deParent.Username = myusrname
                    deParent.Password = mypwd
                    deParent.AuthenticationType = AuthenticationTypes.Secure

                    Dim ds As DirectorySearcher = New DirectorySearcher(deParent, sFilter, columns, SearchScope.Subtree)
                    ds.PageSize = 1000
                    Using (deParent)
                        userDS = New DataSet("userDS")
                        Dim dt As DataTable = userDS.Tables.Add("users")
                        Dim dr As DataRow

                        For Each prop As String In columns
                            dt.Columns.Add(CType(prop, String))
                        Next

                        Dim src As SearchResultCollection = ds.FindAll()    ''''the error was thrown out at this line
                        Using (src)
                            For Each sr As SearchResult In src
                                dr = dt.NewRow()
                                For Each prop As String In columns
                                    If (sr.Properties.Contains(prop)) Then
                                        dr(prop) = sr.Properties(prop)(0)
                                    End If
                                Next
                                dt.Rows.Add(dr)
                            Next
                        End Using
                    End Using
                    context.Cache.Insert(sFilter, userDS, Nothing, DateTime.MaxValue, TimeSpan.FromSeconds(180))
                End If

     

  • Re: The server is not operational.

    06-17-2008, 4:20 PM
    • Loading...
    • raghu1
    • Joined on 10-28-2005, 3:50 PM
    • Posts 409
    • Points 1,805

    What is the value of path? What was the value when it was working ? This I am assuming is the LDAP path and should be something like : LDAP://YourDomainName,DC=..DC=..

     

  • Re: The server is not operational.

    06-17-2008, 4:23 PM
    • Loading...
    • bullpit
    • Joined on 06-29-2006, 3:59 PM
    • Posts 4,594
    • Points 20,761
  • Re: The server is not operational.

    06-17-2008, 4:28 PM
    • Loading...
    • KentZhou
    • Joined on 05-03-2006, 11:48 AM
    • Posts 540
    • Points 1,006

    The LDAP connection string is oaky:

    LDAP://Domainservername/OU=ABC,DC=abc,DC=ca

    Things I don't understand is: at first time.  LDAP://Domainservername/OU=ABC,DC=abc,DC=ca worked. Then it didn't work sometime later. Then I changed to

    LDAP://domainservername/OU=ABC,DC=abc,DC=ca

    It worked again. Then sometime later it didn't work again. Then I changed to

    LDAP://Domainservername.abc.ca/OU=ABC,DC=abc,DC=ca

    It worked again. It's crazy!
     

Page 1 of 1 (4 items)