I know this is almost a duplicate: Error "Login failed for user" NT AUTHORITY \ IUSR "" in ASP.NET and SQL Server 2008 and Login failed for user "username" - System.Data.SqlClient.SqlException with LINQ to external project / class library, but some things don't stack up compared to other applications on my server, and I'm not sure why.
Used boxes:
Web box
SQL Box
SQL Test Box
My expression:
I have an ASP.NET web application that references a class library that uses LINQ-to-SQL. The connection string is configured correctly in the class library. In case of login failure for the user 'username' - System.Data.SqlClient.SqlException with LINQ in the external library of projects / classes. I also added this connection string to the web application.
The connection string uses SQL credentials per se (both in the web application and in the class library):
<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" />
This connection is confirmed to be working by adding it to the server browser. This is the connection string my .dbml file uses.
This problem:
I get the following error:
System.Data.SqlClient.SqlException: Login failed for user 'DOMAIN\MACHINENAME$'.
Now refer to this . The error "Login failed for NT AUTHORITY \ IUSR user" in ASP.NET and SQL Server 2008 means that a truly local network service and the use of any other non-domain name will not work.
But I got confused because I checked both SQL Box and SQL Test Box SQL Management Studio, and both have the NT AUTHORITY/NETWORK SERVICE section Security β Logon, at the database level, which is not in the Security β Users list, but on database level Security β Users I have a user displayed in the connection string.
At the NTFS level on the web server, the NETWORK SERVICE permissions have full control.
The reason I got confused is because there are many other web applications on my web server that reference the SQL Box and SQL Test Box databases, and they all work. But I can not find the difference between them and my current application, except that I use a class library. Will it make a difference? Checking NTFS permissions, configuring security entries at the server and database levels, the connection string and connection method (SQL Server credentials), as well as the IIS application pool and other folder settings are all the same.
Why do these applications work without adding the $ machine name to the permissions of any of my SQL blocks? But this is what one link tells me to do to solve this problem.