Login failed for user 'myusename' RRS feed

  • Question

  • User1872147380 posted


    I'm migrating a .net application database application from SQL Server 2008 R2 to SQL Server 2014. The application runs on our intranet, using Windows Authentication and an AD group. Database authentication runs under a SQL server user login, which has access to all the required database objects etc. My application grants access to the Windows user group using the authorization tab in my web.config file.

    The IIS service is running under Windows Server 2012, IIS version 8.0.9 and is on one virtual machine. The SQL Server is on another virtual machine, running Windows Server 2012 (same configuration with my SQL Server 2008 databases).

    The live application is running fine under its current configuration. However, I'm having some major issues once I've migrated the database to SQL Server 2014.

    I can run the application fine from Visual Studio 2015, and the login works fine so I know there is no issue with authentication to SQL Server using the credentials supplied in the web.config file. I can also login to SSMS with the same credentials.

    However, in testing the application on the IIS Server (i.e I select 'browse' to open browser session), and entering what I know are the correct AD credentials, I get the message 'Login failed for 'myusername'.

    This only happens on the server running SQL Server 2014. I have several applications running successfully with this configuration on SQL server 2008, so I'm stumped as to what is causing this issue.

    Can anyone help?


    <edit>Should be in the 'ISS7 and above forum'. Apologies.</edit>

    Monday, June 25, 2018 9:10 AM

All replies

  • User121216299 posted

    Hi Majhl,

    If this error message occurs every time in an application using Windows Authentication, and the client and the SQL Server instance are on separate machines, then ensure that the account which is being used to access SQL Server is a domain account.  If the account being used is a local account on the client machine, then this error message will occur because the SQL Server machine and the Domain Controller cannot recognize a local account on a different machine. 

    The next step for this is to create a domain account, give it the appropriate access rights to SQL Server, and then use that domain account to run the client application.

    Try to refer article below may help you to solve the issue.

    Understanding the error message: “Login failed for user ”. The user is not associated with a trusted SQL Server connection.”



    Wednesday, June 27, 2018 6:21 AM