• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1555
  • Last Modified:

Cannot open user default database. Login failed for user 'ERYN\ASPNET'.

hi there,

please help, i would be very grateful.

i have created a website and let visual studio 2005 create the aspnetdb.mdf file.
i copied all my tables into the aspnetdb database. i deployed the website to the folder C:\Inetpub\wwwroot\ACAAS

Opening my browser and navigating to http://localhost/ACAAS/Default.aspx, i see the default page, and a few entries read from the ASPNETDB database, so reading is fine. however when actually logging in or attempting any action that requires writing to the database, the following exception occurs:

Cannot open user default database. Login failed.
Login failed for user 'ERYN\ASPNET'.

Exception Details: System.Data.SqlClient.SqlException: Cannot open user default database. Login failed.
Login failed for user 'ERYN\ASPNET'.

In no particular order i have done the following to no avail:

i gave full control to ASPNET process on the ACAAS directory in my wwwroot folder under security settings.

under control panel -> User Accounts, i have assigned ASPNET process to administrator group.

logging into SQL Server Management Studio Express using windows authentication, i have attached ASPNETDB and created a new user: aspnet, password: aspnet@123 and mapped it to all the databases like master etc including ASPNETDB.

i did the same for the sa account

i set the default database for both these accounts to ASPNETDB, (not sure if i has to, did it anyway)

My connection string residing in webconfig is as follows:

<add name="ACAAS" connectionString="Data Source=ERYN\SQLEXPRESS;Database=ASPNETDB;uid=aspnet;password=aspnet@123;Integrated Security=False;User Instance=False" providerName="System.Data.SqlClient" />

using the surface area configurator, i enabled remote connections with the tcp/ip and named pipes option. (not sure if i had to did it anyway)

using the sseutil utility i detached all database instances, except for master, etc. for those i couldn't remove i.e. sseutil -d <database path> doesn't like the 'and' in path 'Documents and Settings', i open up task manager and kill all my sqlservr, browser and writer processes.

i used the aspnet_regiis utility to register ASPNET 2.0....57 with IIS.

Express and i do not have VS2005 open.

i restart my computer after making changes and check that the processes are up and running before attempting again.

i think that's all i've done. i belong to a domain but trying on either logins makes no difference.

i'm running XP SP2, IIS with the SMTP, ASPNET 1.1 and 2.0, i got VS2003 and VS2005, SQL Server 2000 and SQL Server Management Studio Express, McAfee VirusScan Enterprise and IE7.

if you want me to run any utilities please be quite specific where i can find them and what i must do.

thank you.
  • 5
  • 2
3 Solutions

Add a new login called 'ERYN\ASPNET' with windows auth.  give proper database access.
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>Cannot open user default database. Login failed.

that error message means that the default database of the login that is used to connect is NOT mapped to the login.
please double check the config, including if you look at the right instance, configure the correct login, and if your connection string matches.

Eryn-South_AfricaAuthor Commented:
thanks for the prompt response, looking under SSMSE, i have checked that mixed mode is enabled for ERYN\SQLEXPRESS

i have looked under security ->logins i see user aspnet, i see that it is mapped to all databases, it appears under the ASPNETDB database users as well. (i had already added ERYN\ASPNET to users (more on this later))

looking in my deployed webconfig i see


using sseutil -l    i see some other databases attached... didn't do anything bout them for now...

opened browser, ran site, same story, Question: why is it using ERYN\ASPNET? (isn't this windows authentication?), i want it to use the user: aspnet (SQL Server authentication).

have i inadvertantly changed something i shouldn't have
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Eryn-South_AfricaAuthor Commented:
do i need to grant any explicit permissions for users on the attached ASPNETDB database?
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>do i need to grant any explicit permissions for users on the attached ASPNETDB database?
not for the login attempt itself.

now, what is the default database configured for that login? does that database exist?
Eryn-South_AfricaAuthor Commented:

i was using ASPNETDB as the default database for user: aspnet. my coworker guessed that because it's the same as the ASPNET account it might interfere, so i changed it to aspnet1 and double checked all the defaults and mappings. everything looks ok, still this error.
Eryn-South_AfricaAuthor Commented:
my coworker also said that ERYN\ASPNET shouldn't even have a login, that there was no reason for it being on SSMSE, could he be right? since i was the one who added it with mappings.
Eryn-South_AfricaAuthor Commented:
while all your comments are absolutely correct, something is still prohibiting the ASPNET process from accessing my application.

my sqlexpress might be configured incorrectly, so i'm going to implement the membership database using SQL2000 using scott gu's blog as a guideline.

if this still fails, i'm going to uninstall vs2005/3, iis and ssmse, etc and try again.

thank you for your comments

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now