title: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON' error in aspx page of dynamics CRM
body: <p>SSPI security failed to connect from application server to remote database server.</p>
  
  <p>I am trying to edit the web.config in an aspx page which is embedded in Dynamics CRM.
  The previous web.config connectionstring is like below:</p>
  
  <pre><code>&lt;add name="conn" connectionString="Server=10.138.50.133;MultipleActiveResultSets=True;Database=dbserverip;User Id=domain\CRMADMINUAT;Password=p@ssword" providerName="System.Data.SqlClient" /&gt;
  </code></pre>
  
  <p>Due to security concern, now I need to change the integrated security to SSPI.</p>
  
  <pre><code> &lt;add name="conn" connectionString="Data Source=SGARCRMDBUAT;Initial Catalog=DB_MSCRM;Integrated Security=SSPI" providerName="System.Data.SqlClient" /&gt;
  </code></pre>
  
  <p>However, it is always failed to connect with the database server and throwing me this error:</p>
  
  <pre><code> [SqlException: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.]
  </code></pre>
  
  <p>below are steps that I have taken but still not working:</p>
  
  <ol>
  <li><p>change the CRM Application Pool identity from <strong>Local System</strong> to a <strong>sysadmin user</strong> which has admin rights on both App and DB server.</p></li>
  <li><p>add <code>&lt;identity impersonate="true"/&gt;</code> into web.config </p></li>
  <li><p>Disable <code>Anonymous Authentication</code> of the site. Enable <code>ASP.NET Impersonatation</code></p></li>
  <li><p>Change Integrated Security=true</p></li>
  <li><p>No special Delegation configuration in AD</p></li>
  </ol>
  
  <p>And i realized that the site is working normally in server localhost, only showing anonymous error when i try to access from my PC which is in same LAN network as the server. </p>
  
  <p>There's another weird thing happened. <strong>When i create a new login user 'NT AUTHORITY\ANONYMOUS LOGON' in Database, the error was gone and the page was working perfectly as before!!</strong> Seems like the 'NT AUTHORITY\ANONYMOUS LOGON' is a hard coded user or configuration?? But i have checked my code, no such things exist in my code.</p>
  
  <p>Really hope that someone could help me.. Thanks ahead.</p>