I am developing a program in .Net and it works great in the development environment. It connects to a few databases (SQL Server) and uses SSPI authentication to do so. When I move this program local to the server that actually runs the SQL Server and run it on the same account I was testing with (i.e. I'm sure the permissions are good) it throws an error saying it can't validate the login due to the login coming from an untrusted domain.

In the past I have worked around this by using SQL Logins in the connection string instead, but I'm tired of using this dirty hack and I want to get to the bottom of why my account can't connect to a database when the program is executed on the same server.

I'd be happy to provide any other details necessary to solve this problem, but I have a feeling it might be something simple that I am unaware of.

The environment is Windows Server 2008, running a .NET 4.0 application and trying to connect to SQL Server 2012.


I had encountered this error before but forgot the solution. This error occurred because my connection string used a DNS name for the server instead of the actual computer name. When this connection string is used locally on the computer, it sees it as unauthorized. The fix is to refer to the database server by the computer name instead of the DNS name in the connection string if you plan to connect to a server on the same computer (or you could just use localhost if no other users on different computers use this same connection string / application)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.