locked
Error: The specified domain either does not exist or could not be contacted RRS feed

  • Question

  • User1965432531 posted
    Hi thr, What I’m doing is to find which group the login user is belong to (in Intranet). Here is my code: Dim objDE As DirectoryEntry Dim strPath As String = "LDAP://OU=Office of Sales,DC=mycom,DC=com" ' Create a new DirectoryEntry with the given path. objDE = New DirectoryEntry(strPath,”mycom/myname”,”pwd”) Dim mySearcher As New DirectorySearcher(objDE) Dim i As Integer mySearcher.Filter = "(&(ObjectClass=User)(samaccountname=" & username & "))" mySearcher.PropertiesToLoad.Add("memberof") Dim mySearchResult As SearchResult = mySearcher.FindOne() If (mySearchResult Is Nothing) Then Return False Else ‘Code to examine the group here… …… End If I set impersonate=”True” in Web.Config. I also set IIS security to Basic Authentication ONLY (disable anonymous). My account (mycom\myname) has the access right to read AD. The thing is if login as “mycom\myname”, everything works fine. If I login as “myname” (skip mycom\ domain) then I got the error message of “The specified domain either does not exist or could not be contacted error”. Process stop on this line: Dim mySearchResult As SearchResult = mySearcher.FindOne() I guess the error is because I didn’t login into the domain, but in program I set objDE = New DirectoryEntry(strPath,”mycom/myname”,”pwd”) which using domain/account to access AD. Am I wrong? How to fix it??? Thanks for your help.
    Monday, January 26, 2004 3:19 PM

Answers

  • User1354132231 posted
    When you run the program with Basic Auth, it runs under domain credentials so it can resolve the serverless bind. In other scenarios, the process account is a non-domain account, so it has no idea of how to resolve "LDAP://OU=Office of Sales,DC=mycom,DC=com". To fix this, you just need to specify a server to bind to (or continue to run with domain credentials): "LDAP://domaincontroller.mycom.com/OU=Office of Sales,DC=mycom,DC=com"
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 26, 2004 5:30 PM

All replies

  • User1354132231 posted
    When you run the program with Basic Auth, it runs under domain credentials so it can resolve the serverless bind. In other scenarios, the process account is a non-domain account, so it has no idea of how to resolve "LDAP://OU=Office of Sales,DC=mycom,DC=com". To fix this, you just need to specify a server to bind to (or continue to run with domain credentials): "LDAP://domaincontroller.mycom.com/OU=Office of Sales,DC=mycom,DC=com"
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 26, 2004 5:30 PM
  • User1965432531 posted
    I got it. Thanks!
    Tuesday, January 27, 2004 12:59 PM
  • User-377607679 posted

    Hi Dunnry,

         I've a problem. When I run my application directly then it serches the Domain name but when I run it after creating Virtual directory from IIS, it gives an error:-

    The specified domain either does not exist or could not be contacted.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Runtime.InteropServices.COMException: The specified domain either does not exist or could not be contacted.


    Source Error:

    Line 97:     {
    Line 98:         DirectoryEntry entryroot = new DirectoryEntry("LDAP://RootDSE");
    Line 99:         string Domain = entryroot.Properties["defaultNamingContext"][0].ToString();
    Line 100:      
    Line 101:        string host = "Only For Intranet Users";

    Source File: c:\Inetpub\wwwroot\TimeSheetMixedAuth\WindowsLogin.aspx.cs    Line: 99

    Stack Trace:

    [COMException (0x8007054b): The specified domain either does not exist or could not be contacted.
    ]
       System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +610
       System.DirectoryServices.DirectoryEntry.Bind() +36
       System.DirectoryServices.DirectoryEntry.get_AdsObject() +31
       System.DirectoryServices.PropertyValueCollection.PopulateList() +25
       System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName) +92
       System.DirectoryServices.PropertyCollection.get_Item(String propertyName) +131
       _Default.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\TimeSheetMixedAuth\WindowsLogin.aspx.cs:99
       System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
       System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
       System.Web.UI.Control.OnLoad(EventArgs e) +99
       System.Web.UI.Control.LoadRecursive() +47
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061
    


    Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210

    please help me

    thanks a lot

    AKS<!-- [COMException]: The specified domain either does not exist or could not be contacted. at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_AdsObject() at System.DirectoryServices.PropertyValueCollection.PopulateList() at System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName) at System.DirectoryServices.PropertyCollection.get_Item(String propertyName) at _Default.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\TimeSheetMixedAuth\WindowsLogin.aspx.cs:line 99 at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) [HttpUnhandledException]: Exception of type 'System.Web.HttpUnhandledException' was thrown. at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.windowslogin_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\ctx_smautho\e0495f8b\2293f82f\App_Web_qooonugs.0.cs:line 0 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) -->

    Tuesday, July 24, 2007 5:41 AM