title: The server cannot handle directory requests when trying to validate domain credentials
body: <p>We have an MVC app running in IIS on a Windows Server 2012 R2 OS that uses the domain accounts to validate user access. This works for most servers except one customer set up. We get the generic "The server cannot handle directory requests" during the PrincipalContext.ValidateCredentials. The IIS app pool uses a domain user that has admin rights to the local server to execute all transactions.</p>
  
  <p>To narrow down what's causing the issue, we've ported to code to a winforms app, and a powershell script. We logged in to the machine as the domain user used in the app pool and ran both programs. Both returned the same error.</p>
  
  <p>However, when we logged in to the server using a domain admin, the exception is no longer thrown and we are able to validate against the AD. </p>
  
  <p>We just want to know what could be causing this behavior. Any help is greatly appreciated.</p>
  
  <p>Below is the powershell script we made:</p>
  
  <pre><code>$UserName = "Foo"
  $Password = "Bar"
  $Domain = "mydomain"
  
  Add-Type -AssemblyName System.DirectoryServices.AccountManagement
  $DS = New-Object System.DirectoryServices.AccountManagement.PrincipalContext('domain',$Domain)
  $DS.ValidateCredentials($UserName, $Password)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/6NaYc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6NaYc.png" alt="App Pool Configurations"></a></p>