Talk About Network

Google





Software > ADSI General > COMException tr...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 8 Topic 5301 of 5437
Post > Topic >>

COMException trying to query the Global Catalog

by =?Utf-8?B?UmljaCBBcm1zdHJvbmc=?= <RichA24@[EMAIL PROTECTED] > Jun 10, 2008 at 04:15 PM

I'm trying to query the GC from an ASP.NET application whose worker process

is running as Local System. It's throwing "...
InteropServices.COMException 
(0x8007200f): The directory service is unavailable." when it calls the 
FindAll() method. The code appears below.
 
//DirectoryEntry globalCatalog = new DirectoryEntry("GC://" + 
Forest.GetCurrentForest().Name);
//DirectoryEntry globalCatalog = new DirectoryEntry("GC:");
DirectoryEntry globalCatalog = new DirectoryEntry("GC://dc01.acme.net");
//globalCatalog.Username = "MyUser@[EMAIL PROTECTED]
";
//globalCatalog.Password = "Pas$w0rd";
IEnumerator gcEnumerator = globalCatalog.Children.GetEnumerator();
gcEnumerator.MoveNext();
globalCatalog = (DirectoryEntry)gcEnumerator.Current;
//globalCatalog.AuthenticationType |= AuthenticationTypes.ServerBind;
 
// Logic to define the filter and properties to load ...
string filter = ...;
string[] propertiesToLoad = new string[] { ... };

using (DirectorySearcher globalSearcher = new 
DirectorySearcher(globalCatalog)) {
    globalSearcher.Filter = string.Format(filterPattern, (gettingUsers ? 
"user" : "group"), filter);
    globalSearcher.PropertiesToLoad.AddRange(propertiesToLoad);
    foreach (SearchResult adPrincipal in globalSearcher.FindAll()) {
        // Do stuff with adPrincipal
}
 
I've left in several commented lines to illustrate some of the things I've

tried based on what others with similar problems have tried: connecting
with 
and without alternate credentials, serverless binding vs. binding to a
named 
server, binding with and without specifying a forest or domain. I'm not
sure 
that using the first child is necessary, but it doen't affect the outcome 
either way.
 
I can connect to servers in the forest using the API in 
System.DirectoryServices.AccountManagement, but the forest I'm working
with 
is spread all over the globe -- which makes things painfully slow -- and 
S.DS.AM doesn't give me a way to query the GC. Any thoughts on what's
wrong 
would be much appreciated.
 
TIA.
 

-- 
Rich Armstrong
 




 8 Posts in Topic:
COMException trying to query the Global Catalog
=?Utf-8?B?UmljaCBBcm1zdHJ  2008-06-10 16:15:00 
RE: COMException trying to query the Global Catalog
=?Utf-8?B?UmljaCBBcm1zdHJ  2008-06-10 16:24:00 
Re: COMException trying to query the Global Catalog
"Joe Kaplan" &l  2008-06-10 20:44:54 
Re: COMException trying to query the Global Catalog
=?Utf-8?B?UmljaCBBcm1zdHJ  2008-06-11 08:07:01 
Re: COMException trying to query the Global Catalog
"Joe Kaplan" &l  2008-06-11 12:11:16 
Re: COMException trying to query the Global Catalog
=?Utf-8?B?UmljaCBBcm1zdHJ  2008-06-11 10:48:03 
Re: COMException trying to query the Global Catalog
jetan@[EMAIL PROTECTED]   2008-06-12 09:20:32 
Re: COMException trying to query the Global Catalog
"Rich Armstrong"  2008-06-23 08:23:38 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Thu Jan 8 21:06:13 PST 2009.