为什么我收到此错误:Windows身份验证上的System.Runtime.interopservice.ComException

时间:2010-10-22 09:43:56

标签: asp.net authentication active-directory windows-authentication

我在asp.net中使用Windows身份验证在本地的每个东西都可以,但是当在同一个域的不同系统上部署时,它在此行中的工作获取错误SearchResult userObject = adSearcher.FindOne();

错误

system.runtime.interopservice.comException

我的代码是

    WindowsIdentity winId = id as WindowsIdentity;
    if (id == null)
    {
        Console.WriteLine("Identity is not a windows identity");
        return;
    }

    string userInQuestion = winId.Name.Split('\\')[1];
    string myDomain = winId.Name.Split('\\')[0];                       
    DirectoryEntry entry = new DirectoryEntry("LDAP://" + myDomain);
    DirectorySearcher adSearcher = new DirectorySearcher(entry);

    adSearcher.SearchScope = SearchScope.Subtree;
    adSearcher.Filter = "(&(objectClass=user)(samaccountname=" + userInQuestion + "))";
    SearchResult userObject = adSearcher.FindOne();
    StringBuilder data =new StringBuilder();

错误页面: link text

2 个答案:

答案 0 :(得分:1)

从您的错误页面,它在目录Bind上失败。新计算机上的应用程序池是否有权查询AD?

答案 1 :(得分:0)

  Dim Connection As New ADODB.Connection
     Connection.Open(ConnectionString)
     Dim Insname As String
     Dim postname As String