Active Directory COM Exception - An operations error occurred (0x80072020)

前端 未结 8 985
灰色年华
灰色年华 2020-11-28 10:39

I am getting an intermittent COM Exception \"An operations error occurred (0x80072020)\" (shown below) when I try and query Active Directory using the metho

8条回答
  •  半阙折子戏
    2020-11-28 11:16

    Granted this is 2 years later, I ran into this and found that the following solved my issue:

    using System.Web.Hosting;
    ...
    ...
    // Code here runs as the logged on user
    
    using (HostingEnvironment.Impersonate()) {
    // This code runs as the application pool user
         DirectorySearcher searcher ...
    }
    

    reference

提交回复
热议问题