Cannot Open default database. Invalid login for [machine name]\[username]

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • namrataa
    New Member
    • Mar 2008
    • 15

    Cannot Open default database. Invalid login for [machine name]\[username]

    Hi,

    I have written services in WCF using C# and hosted using IIS. the service is to check for valid user and register new user.
    The problem is that the application works properly. But when I want to check the database in the server explorer I get error message saying "Cannot Open default database. Invalid login for [machine name]\[username]".

    I am not understanding what the problem is. Again when I restart my system it again gives me the error saying "Cannot Open default database. Invalid login for [machine name]\ASPNET" so at that time I go to Right click on My Computers Click on Manage-->Users-->ASPNET-->Add SQLuser.
    Log off & login again it works fine. Whats the problem & solutions also

    Pleaseeeeeeee
  • nateraaaa
    Recognized Expert Contributor
    • May 2007
    • 664

    #2
    Originally posted by namrataa
    Hi,

    I have written services in WCF using C# and hosted using IIS. the service is to check for valid user and register new user.
    The problem is that the application works properly. But when I want to check the database in the server explorer I get error message saying "Cannot Open default database. Invalid login for [machine name]\[username]".

    I am not understanding what the problem is. Again when I restart my system it again gives me the error saying "Cannot Open default database. Invalid login for [machine name]\ASPNET" so at that time I go to Right click on My Computers Click on Manage-->Users-->ASPNET-->Add SQLuser.
    Log off & login again it works fine. Whats the problem & solutions also

    Pleaseeeeeeee
    I believe you need to add the [machine name]\ASPNET user to your database roles so that the database server will allow this user to connect to your database.

    Nathan

    Comment

    • namrataa
      New Member
      • Mar 2008
      • 15

      #3
      Originally posted by nateraaaa
      I believe you need to add the [machine name]\ASPNET user to your database roles so that the database server will allow this user to connect to your database.

      Nathan
      How to add database role in detail. i don't know anything about it.

      Comment

      • nateraaaa
        Recognized Expert Contributor
        • May 2007
        • 664

        #4
        Originally posted by namrataa
        How to add database role in detail. i don't know anything about it.
        What database server are you using?
        SQL 2000
        SQL 2005
        or something else

        Nathan

        Comment

        • namrataa
          New Member
          • Mar 2008
          • 15

          #5
          Originally posted by nateraaaa
          What database server are you using?
          SQL 2000
          SQL 2005
          or something else

          Nathan
          I am using SQL2005 which comes inbuilt with VS2008.

          Comment

          Working...