title: Login failed for user 'DOMAIN\MACHINENAME$'
body: <p>I know this is almost a duplicate of : <a href="https://stackoverflow.com/questions/1269706/the-error-login-failed-for-user-nt-authority-iusr-in-asp-net-and-sql-server-2">The error &quot;Login failed for user &#39;NT AUTHORITY\IUSR&#39;&quot; in ASP.NET and SQL Server 2008</a> and <a href="https://stackoverflow.com/questions/97594/login-failed-for-user-username-system-data-sqlclient-sqlexception-with-linq-i">Login failed for user &#39;username&#39; - System.Data.SqlClient.SqlException with LINQ in external project / class library</a> but some things don't add up compared to other appliations on my server and I am not sure why.</p>
  
  <p><strong>Boxes being used:</strong></p>
  
  <p>Web Box<br>
  SQL Box<br>
  SQL Test Box</p>
  
  <p><strong>My Application:</strong></p>
  
  <p>I have an ASP.NET Web Application, which references a class library that uses LINQ-to-SQL. Connection string set up properly in the class library. As per <a href="https://stackoverflow.com/questions/97594/login-failed-for-user-username-system-data-sqlclient-sqlexception-with-linq-i">Login failed for user &#39;username&#39; - System.Data.SqlClient.SqlException with LINQ in external project / class library</a> I also added this connection string to the Web Application. </p>
  
  <p>The connection string uses SQL credentials as so (in both web app and class library):</p>
  
  <pre><code> &lt;add name="Namespace.My.MySettings.ConnectionStringProduction"
          connectionString="Data Source=(SQL Test Box);Initial Catalog=(db name);Persist Security Info=True;User ID=ID;Password=Password"
          providerName="System.Data.SqlClient" /&gt;
  </code></pre>
  
  <p>This connection confirmed as working via adding it to Server Explorer. This is the connection string my .dbml file is using.</p>
  
  <p><strong>The problem:</strong></p>
  
  <p>I get the following error:</p>
  
  <pre><code>System.Data.SqlClient.SqlException: Login failed for user 'DOMAIN\MACHINENAME$'.
  </code></pre>
  
  <p>Now referencing this <a href="https://stackoverflow.com/questions/1269706/the-error-login-failed-for-user-nt-authority-iusr-in-asp-net-and-sql-server-2">The error &quot;Login failed for user &#39;NT AUTHORITY\IUSR&#39;&quot; in ASP.NET and SQL Server 2008</a> it says that's really the local network service and using any other non-domain name will not work. </p>
  
  <p>But I am confused because I've checked both SQL Box and SQL Test Box SQL Management Studio and both have <code>NT AUTHORITY/NETWORK SERVICE</code> under Security -> Logins, at the database level, that isn't listed under Security -> Users, but at the database level Security -> Users I have the user displayed in the connection string.</p>
  
  <p>At NTFS level on web server, the permissions have NETWORK SERVICE has full control.</p>
  
  <p>The reason why I am confused is because I have many other web applications on my Web Server, that reference databases on both SQL Box and SQL Test Box, and they all work. But I cannot find a difference between them and my current application, other than I am using a class library. Will that matter? Checking NTFS permissions, setup of Security Logins at the server and databases levels, connection string and method of connecting (SQL Server credentials), and IIS application pool and other folder options, are all the same.</p>
  
  <p>Why do these applications work without adding the machinename$ to the permissions of either of my SQL boxes? But that is what the one link is telling me to do to fix this problem.</p>