>> This sounds like an issue with the ADSI connection caching model.
>> Essentially, your code is not reusing an existing LDAP connection and is
>> opening a new one with each DirectoryEntry or DirectorySearcher you are
>> creating. Eventually you run out of TCP/IP wild card ports with all the
>> sockets being opened and closed because the closed sockets stay in "TIME
>> WAIT" for 60 seconds before they can be recycled.
>>
>> You usually work around this issue by opening a single DirectoryEntry object
>> to the server in question with the credentials you are using and then
>> keeping this object open for the duration of the program. For it to bind
>> using the NativeObject property (or calling RefreshCache) and then stick it
>> in a static variable so it doesn't get collected. That should fix it
>> (unless you are changing credentials frequently, in which case this won't
>> work). You should also get much better perf.
>>
>> It is ok and actually a good idea to continue calling Dispose on the rest of
>> your DirectoryEntry, DirectorySearcher and SearchResultCollection objects
>> (and any other IDisposable objects you are using), just not the first one.
>>
>> If you want to see the wild card port issue in action, check the results of
>> netstat while you are having the problem.
>>
>> There is a bit more detail on this issue in ch 3 of my book (see link in
>> sig).
>>
>> Joe K.
>>
>> --
>> Joe Kaplan-MS MVP Directory Services Programming
>> Co-author of "The .NET Developer's Guide to Directory Services Programming"
>>
http://www.directoryprogramming.net
>> --
>> "Pickle Matrix Technician" <Pickle Matrix
>> Technician@discussions.microsoft.com> wrote in message
>> news:D6231313-2B0F-4B73-8523-59B2C506BEDF@microsoft.com...