title: System.DirectoryServices.DirectoryServicesCOMException
body: <p>I keep getting the following error when trying to run an application in the production environment with "anonymous" authentication and hardcoded username.</p>
  
  <p>When I turn on basic authentication, which then prompts for username/password everything works like a charm. but I need to get the hardcoded version to work as well. Can't figure out whats going on.</p>
  
  <p>Everything works perfectly on another server.</p>
  
  <blockquote>
    <p>Exception Details: System.DirectoryServices.DirectoryServicesCOMException: An operations
    error occurred.</p>
    
    <p>Source Error: </p>
    
    <p>An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of
    the exception can be identified using the exception stack trace below.</p>
    
    <p>Stack Trace: </p>
    
    <p>[DirectoryServicesCOMException (0x80072020): An operations error occurred.]<br>
    System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +781<br>
    System.DirectoryServices.DirectoryEntry.Bind() +44<br>
    System.DirectoryServices.DirectoryEntry.get_SchemaEntry() +49<br>
    System.DirectoryServices.AccountManagement.ADStoreCtx.IsContainer(DirectoryEntry
    de) +62<br>
    System.DirectoryServices.AccountManagement.ADStoreCtx..ctor(DirectoryEntry
    ctxBase, Boolean ownCtxBase, String username, String password,
    ContextOptions options) +123<br>
    System.DirectoryServices.AccountManagement.PrincipalContext.CreateContextFromDirectoryEntry(DirectoryEntry
    entry) +234<br>
    System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInit()
    +497  </p>
    
    <p>[PrincipalOperationException: An operations error occurred.]<br>
    System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInit()
    +534256<br>
    System.DirectoryServices.AccountManagement.PrincipalContext.DoDomainInit()
    +61<br>
    System.DirectoryServices.AccountManagement.PrincipalContext.Initialize()
    +141<br>
    System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx()
    +42<br>
    System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext
    context, Type principalType, Nullable`1 identityType, String
    identityValue, DateTime refDate) +27<br>
    System.DirectoryServices.AccountManagement.GroupPrincipal.FindByIdentity(PrincipalContext
    context, String identityValue) +95<br>
    SERT_BO.ADHelper.UserBelongsToGrp(String adGroup, String sAMAccountName, String&amp; emailAddr, String&amp; fullName) in
    D:\SERT\BusinessObjects\SERT_BO\ADHelper.cs:199<br>
    SERT_BO.UserSession.GetUserSession(String userName) in D:\SERT\BusinessObjects\SERT_BO\UserSession.cs:44<br>
    SERT.SetUserSession.Page_Load(Object sender, EventArgs e) in D:\SERT\SERT\SERT\SetUserSession.aspx.cs:23<br>
    System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25<br>
    System.Web.UI.Control.LoadRecursive() +71<br>
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    +3064  </p>
  </blockquote>