Connecting Tech Pros Worldwide Forums | Help | Site Map

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

Newbie
 
Join Date: Mar 2008
Posts: 15
#1: Mar 10 '08
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's Avatar
Expert
 
Join Date: May 2007
Location: Illinois
Posts: 663
#2: Mar 10 '08

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


Quote:

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
Newbie
 
Join Date: Mar 2008
Posts: 15
#3: Mar 11 '08

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


Quote:

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.
nateraaaa's Avatar
Expert
 
Join Date: May 2007
Location: Illinois
Posts: 663
#4: Mar 11 '08

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


Quote:

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
Newbie
 
Join Date: Mar 2008
Posts: 15
#5: Mar 12 '08

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


Quote:

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.
Reply