Why Login failed for user 'Domainname\AppserverName'." If this type of user is added in the SQL Server Security section but has a different functional username configured within SQL, the error persists

APT LIAISON SUPPORT 0 Reputation points
2024-12-19T07:48:51.3833333+00:00

On the client’s network, the application server and database server are hosted on distinct machines (different servers). When accessing the database via an API developed using .NET Core 8, we encounter the following error:

Login failed for user 'Domainname\AppserverName'."

Here, ‘AppserverName’ represents the actual computer name of the application server. Additionally, to access the database, a connection string is created within the API layer.

 

We would like clarification on the following two points:

  1. Scenario 1: When this type of user is not explicitly added to the SQL Server Security section for Windows Authentication, the above error is encountered.

Q: Why is this user required for authentication?

  1. Scenario 2: If this type of user is added in the SQL Server Security section but has a different functional username configured within SQL, the error persists.

Q: What steps can we take to resolve this issue in such a scenario?

 

It may also be noted that our applications (on ASP .Net 4.6.2) are working and connecting on this environment; however, the .Net Core 8 application is facing above issues.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,749 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,356 questions
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
13,591 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 69,886 Reputation points
    2024-12-19T17:17:01.1133333+00:00

    the error means the application is trying to connect to sqlserver using a trusted connection. for trusted connections the app pool account is used. but your app poo is using a local account, not a domain account. change the app pool account to a domain user that has access to the sqlserver.

    note: you might check the app pool account for your working applications. also check their connect string to see if they used trusted or sql standard security.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.