Link to home
Start Free TrialLog in
Avatar of Eryn-South_Africa
Eryn-South_AfricaFlag for South Africa

asked on

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.
SOLUTION
Avatar of madhevan_pillai
madhevan_pillai
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Eryn-South_Africa

ASKER

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
uid=aspnet;password=aspnet@123;

i restarted ERYN\SQLEXPRESS

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
do i need to grant any explicit permissions for users on the attached ASPNETDB database?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
howdy,

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