Login failed for user '<DOMAIN>\<COMPUTER>$' RRS feed

  • Question

  • I have Windows 7 64 bit OS. I have .Net based application running on IIS. SQL Server 2008 located in different server.

    I get error Login failed for user 'Domain\ServerName$' in the browser.
    So I assumed that this is because Web application is not passing valid credentials to SQL Server.
    So I have edited C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config and added followings: <processModel autoConfig="true" userName="user" password="pwd"/>. I have Anonymous Authentication, ASP.NET Impersonation and Forms Authentication Disabled in the IIS, and Windows Authentication Enabled in the IIS.

    When I open the website by browser I still get error:
    Login failed for user 'Domain\PCName$'.
    Description: An unhandled exception occurred during the execution of the current web request.
    Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'Domain\PCName$'.

    If I enable IIS form authentication and try to login with valid account, I still get login attempt with  'Domain\PCName$', which causes error.

    Why this occurs? Why my application is trying to open DB connection using my workstation name? Why not using username defined in the machine.config?


    Tuesday, March 29, 2011 10:17 AM


All replies

  • Hello,

    Please, could you tell us whether your workstation and the computer where the SQL Server is installed are both on the same Windows network ( or Domain ) ?

    Please, when you write "Login failed for user 'Domain\PCName$'", Domain is the name of the Windows domain and PCName$ the name of a computer ( where is installed the SQL Server or of your workstation ). But where is the name of the user used to connect ?

    I am sorry but my english is not as fluent as i would want to try to help you, so i hope you will excuse me if i am not clear.

    Have a nice day

    PS : Have you added your username and password to the logins authorized to access to your SQL Server and your database ?

    PS2 : What is the authentification mode anabled on the SQL Server ? (Windows or SQL Server authentification )

    Mark Post as helpful if it provides any help.Otherwise,leave it as it is.
    • Edited by Papy Normand Tuesday, March 29, 2011 6:37 PM I have added the PS2 related to the authentification mode
    Tuesday, March 29, 2011 6:32 PM
  • Thanks for your help. I used to have XP and this scenatio worked fine there. I got problem when starting to use Windows 7 64bit.

    1. Workstation and Database server are in same window network and in same domain.

    2. This is error I get from application "Login failed for user 'Domain\PCName$'".
       My plan is that .net based Web Application uses the account that I defined in the machine.config, which is my windows account.

    3. My windows account have user rights to the SQL Server. (This should be no problem)

    4. SQL Server should accept Windows authentication. This should be no problem)


    Wednesday, March 30, 2011 5:55 AM
  • Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'Domain\PCName$'.

    Hi Kenny_I,

    Your application may run as NETWORK SERVICE or LocalSystem account to connect to the remote SQL Server. In this case, the machine account, which is referenced as DOMAIN\MACHINENAME$, is used to connect to the SQL Server.

    Please grant login privileges to the account "domain\machinename$” in the remote SQL Server. For more information, please refer to the following links:



    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Proposed as answer by Papy Normand Thursday, March 31, 2011 8:24 AM
    • Marked as answer by Papy Normand Thursday, March 31, 2011 9:06 PM
    Thursday, March 31, 2011 3:25 AM