Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't access directory services from server - DirectoryServicesCOMException
    primarykey
    data
    text
    <p>I'm trying to query AD in an ASP.Net (4.0) application that is running on Windows Server 2008 R2 (IIS7 installed). In runs fine on my local computer (Windows 7), but not on the server. I'm trying to get the userid of the current user. I've looked at Q&amp;A of similar question, but no success.</p> <p>Here's the code snip...</p> <pre><code>public partial class Default : System.Web.UI.Page { PrincipalContext principalCtx = new PrincipalContext(ContextType.Domain); UserPrincipal currentUser = UserPrincipal.Current; </code></pre> <p>The web.config has </p> <pre><code>&lt;authentication mode="Windows"/&gt; &lt;identity impersonate="true" /&gt; </code></pre> <p>And here's the error &amp; stack trace...</p> <pre><code>[DirectoryServicesCOMException (0x80072020): An operations error occurred. ] System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +781 System.DirectoryServices.DirectoryEntry.Bind() +44 System.DirectoryServices.DirectoryEntry.get_AdsObject() +42 System.DirectoryServices.PropertyValueCollection.PopulateList() +29 System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName) +119 System.DirectoryServices.PropertyCollection.get_Item(String propertyName) +163 System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInitNoContainer() +541617 System.DirectoryServices.AccountManagement.PrincipalContext.DoDomainInit() +51 System.DirectoryServices.AccountManagement.PrincipalContext.Initialize() +141 System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx() +42 System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext context, Type principalType, Nullable`1 identityType, String identityValue, DateTime refDate) +27 System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithType(PrincipalContext context, Type principalType, IdentityType identityType, String identityValue) +146 System.DirectoryServices.AccountManagement.UserPrincipal.FindByIdentity(PrincipalContext context, IdentityType identityType, String identityValue) +44 System.DirectoryServices.AccountManagement.UserPrincipal.get_Current() +390 </code></pre> <p>I've tried running IIS Application Pool as NetworkService and as ApplicationPoolIdentity and no good.</p> <p>Any ideas? Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload