I'm sorry if this question has already been anwered, but I couldn't find it in previous threads. Anyway, I installed the Personal Site Starter Kit and SQL Server Express (both are local). I then created a user for myself, and then I receive
the following error when I log into the site:
System.Data.SqlClient.SqlException: Cannot open user default database. Login failed.
Login failed for user 'MARS\ASPNET'
Apparently, SQL Server Express doesn't like my local ASPNET account. Does anyone know either how to fix this or where I can go to troubleshoot this problem?
Having the same problem and have spent 2 frustrating days trying to figure it out. Project runs from within VS.net OK -- because VS is authenticating as [machine]\ASPNET -- but if I try to run as http://localhost/[application] I just get the "Cannot open
user default database..." error. I've created a [machine]\ASPNET user account in SQL Server Express, assigned it to sysadmin role, have set SQL Express to run in mixed-mode, but all to no avail.
Hi, I am just now making the transition from classic ASP to ASP.Net, I must say getting off the ground and running has been an extreme challenge. The help of these forums are great but all of a sudden I am now getting the same
message;
System.Data.SqlClient.SqlException: Cannot open user default database. Login failed.
Login failed for user 'SERVER\ASPNET'
Have you figured this out yet? If I do I will let you know.
I was able to fix the problem by setting up user impersonation in the asp.net configuration. I don't know enough yet to know if this is a good thing or not. Is it OK, security wise to allow this setting? Also here is my connection string from my web.config
file.
I had the same use and tried a whole bunch of things, but this is what solved it for me:
- it seems I had the DB still opened inside my IDE (Visual Web Developer Express), in the database explorer. Right-clicking the database and selecting "close connection" fixed it.
I have had the same problem and it is really getting frustrating after spending a whole weekend trying to figure it out. Here is what I have done and it's really not a good thing to do, but nothing else works:
I am running Windows XP Pro SP 2 with VS 2005 and SQL Express. I can run the site fine through VS, but when I Publish it to a different folder that my IIS Website is pointing to, I get the same error message when I pull it up in a browser. I am not connected
to a domain, but have the machine setup as a workgroup. The ASPNET id needs access to the folder where the database files are stored. Since I am running the machine as a workgroup, I can't give specific permissions to each user. I put the MACHINENAME\ASPNET
user in the admin group on the machine. I know this is a terrible idea because of security, but it's the only way it will work for me. I think there is some kind of bug in SQL Express and using it under a workgroup instead of a domain, but nobody has actually
figured this one out yet. Hope this helps. Let me know how it goes or if you've come up with another solution.
Changing the value to 0 will give you the security tab in your folders, file properties window.
Also I have noticed sometimes that programs may write to the windows\temp directory, the asp.net user may need rights to this folder on the server machine only. Of course this may not be your case.
Anyway I hope this helps with assigning the user rights in Windows XP Professional.
I do something that:
Download and install SQL Server Managment Studio Express
http://www.microsoft.com/downloads/details.aspx?FamilyID=82afbd59-57a4-455e-a2d6-1d4c98d40f6e&DisplayLang=en
After that I set authentication in SQLServer (use SQL Server Managment Studio Express) to SQL Server and Windows mode and add user localhost\aspnet from Windows and I allow connect them and this work.
spotsrocks
Member
5 Points
1 Post
Cannot open user default database
Nov 21, 2005 06:44 PM|LINK
System.Data.SqlClient.SqlException: Cannot open user default database. Login failed.
Login failed for user 'MARS\ASPNET'
Apparently, SQL Server Express doesn't like my local ASPNET account. Does anyone know either how to fix this or where I can go to troubleshoot this problem?
Thanks in advance,
Rob
Norashlea
Member
5 Points
1 Post
Re: Cannot open user default database
Dec 19, 2005 02:52 AM|LINK
Rob, did you figure out how to resolve this?
Having the same problem and have spent 2 frustrating days trying to figure it out. Project runs from within VS.net OK -- because VS is authenticating as [machine]\ASPNET -- but if I try to run as http://localhost/[application] I just get the "Cannot open user default database..." error. I've created a [machine]\ASPNET user account in SQL Server Express, assigned it to sysadmin role, have set SQL Express to run in mixed-mode, but all to no avail.
Sharon.
rhythmluvr
Member
40 Points
8 Posts
Re: Cannot open user default database
Jan 08, 2006 02:45 PM|LINK
Hi, I am just now making the transition from classic ASP to ASP.Net, I must say getting off the ground and running has been an extreme challenge. The help of these forums are great but all of a sudden I am now getting the same message;
System.Data.SqlClient.SqlException: Cannot open user default database. Login failed.
Login failed for user 'SERVER\ASPNET'
Have you figured this out yet? If I do I will let you know.
smcgroarty
Member
180 Points
36 Posts
Re: Cannot open user default database
Jan 08, 2006 10:44 PM|LINK
Verify the SQL connection string in the web.config file. Are you able to connect to the SQL server that is specified there?
You might need Microsoft SQL Server Management Studio Express avalible at http://www.microsoft.com/downloads/details.aspx?FamilyID=82afbd59-57a4-455e-a2d6-1d4c98d40f6e&DisplayLang=en
http://velcrohurts.com
rhythmluvr
Member
40 Points
8 Posts
Re: Cannot open user default database
Jan 09, 2006 03:04 PM|LINK
I was able to fix the problem by setting up user impersonation in the asp.net configuration. I don't know enough yet to know if this is a good thing or not. Is it OK, security wise to allow this setting? Also here is my connection string from my web.config file.
<
connectionStrings><
add name="dbConnection" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ITNetworkSC.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" /></
connectionStrings>fatmidget
Member
5 Points
1 Post
Re: Cannot open user default database
Jan 23, 2006 08:21 PM|LINK
I had the same use and tried a whole bunch of things, but this is what solved it for me:
- it seems I had the DB still opened inside my IDE (Visual Web Developer Express), in the database explorer. Right-clicking the database and selecting "close connection" fixed it.
Hope this helps.
SPINFX
Member
5 Points
1 Post
Re: Cannot open user default database
Feb 06, 2006 03:47 PM|LINK
I have had the same problem and it is really getting frustrating after spending a whole weekend trying to figure it out. Here is what I have done and it's really not a good thing to do, but nothing else works:
I am running Windows XP Pro SP 2 with VS 2005 and SQL Express. I can run the site fine through VS, but when I Publish it to a different folder that my IIS Website is pointing to, I get the same error message when I pull it up in a browser. I am not connected to a domain, but have the machine setup as a workgroup. The ASPNET id needs access to the folder where the database files are stored. Since I am running the machine as a workgroup, I can't give specific permissions to each user. I put the MACHINENAME\ASPNET user in the admin group on the machine. I know this is a terrible idea because of security, but it's the only way it will work for me. I think there is some kind of bug in SQL Express and using it under a workgroup instead of a domain, but nobody has actually figured this one out yet. Hope this helps. Let me know how it goes or if you've come up with another solution.
rhythmluvr
Member
40 Points
8 Posts
Re: Cannot open user default database
Feb 07, 2006 01:49 AM|LINK
A couple of things you might want to consider in your environment.
You can get the security tab to work in Windows XP Professional that is installed in a workgroup by changing the following registry key
Registry Key and Values
When security settings are set in Windows XP, the following registry key is used:
<div class=indent>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa</div>The values are:
Changing the value to 0 will give you the security tab in your folders, file properties window.
Also I have noticed sometimes that programs may write to the windows\temp directory, the asp.net user may need rights to this folder on the server machine only. Of course this may not be your case.
Anyway I hope this helps with assigning the user rights in Windows XP Professional.
nietoperz82
Member
5 Points
1 Post
Re: Cannot open user default database
Feb 27, 2006 08:39 PM|LINK
I do something that:
Download and install SQL Server Managment Studio Express
http://www.microsoft.com/downloads/details.aspx?FamilyID=82afbd59-57a4-455e-a2d6-1d4c98d40f6e&DisplayLang=en
After that I set authentication in SQLServer (use SQL Server Managment Studio Express) to SQL Server and Windows mode and add user localhost\aspnet from Windows and I allow connect them and this work.
I hope I help.
Nietoperz (bat)
Sorry for my bad English:)
eladros
Member
125 Points
25 Posts
Re: Cannot open user default database
Apr 03, 2006 08:16 PM|LINK
, u r a life saver.This is also solved the problem
10x !