Cannot open user default database

Rate It (1)

Last post 09-08-2009 4:09 PM by misovec. 29 replies.

Sort Posts:

  • Re: Cannot open user default database

    07-09-2007, 1:59 PM

    fatmidget:

    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.

    This one worked for me too.. Thanks for solution
  • Re: Cannot open user default database

    07-30-2007, 4:32 PM
    • Member
      45 point Member
    • jeeva.net
    • Member since 06-11-2007, 7:50 AM
    • Posts 16

    Thanks a Million Monish.. you made my day.. indeed the week today being monday Smile.. a very simple solution for an irritating issue, i was breaking my head for 1 full day !

    Regards,
    Jeeva

  • Re: Cannot open user default database

    09-29-2007, 9:46 AM
    • Member
      14 point Member
    • stibet
    • Member since 09-29-2007, 1:39 PM
    • Posts 29

     

    Well , but I cannot open "Member of" section of the properties. When I try this , it gives me the following error message box ;

     The Following error occured while attempting to read the properties of user ASPNET
    The Server Serivice is not started

    What might be the problem ?

    Thanks in advance

    sst
  • Re: Cannot open user default database

    11-12-2007, 3:40 AM
    • Member
      293 point Member
    • imperialx
    • Member since 06-28-2007, 10:07 AM
    • Posts 810

    fatmidget:

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

     

    Hi, 

     

                   I run into the same problem.

                   Because the close connection is disabled at Database Explorer, I delete the database then add a new connection by choosing the same database deleted. I can now disable the enabled close connection by right clicking the database.

     

    By adding a new connection, the connectionString attribute in connectionStrings at web.config replaces the default connection to

    connectionString="Data Source=[SERVERNAME]\SQLEXPRESS;AttachDbFilename=|DataDirectory|\smsdata.mdf;Integrated Security=True" providerName="System.Data.SqlClient"/>

    just replace the [SERVERNAME] to period(.) like so Data Source=.\SQLEXPRESS    

     

                   Thanks Fatmidget!

     

     

    cheers,
    imperialx 

     

  • Re: Cannot open user default database

    12-05-2007, 11:20 AM
    • Member
      10 point Member
    • xiaoweib
    • Member since 12-03-2007, 2:08 AM
    • Posts 5

    I tried this way, but still has

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

    my database is not at local machine, it is remote machine. I can't use this way. what can I do????

  • Re: Cannot open user default database

    05-02-2008, 7:49 PM
    • Member
      2 point Member
    • ruchis
    • Member since 05-02-2008, 11:48 PM
    • Posts 1

     Hey...It worked for me...This was nicely done....Thank u...

  • Re: Cannot open user default database

    06-07-2008, 1:05 PM
    • Member
      2 point Member
    • gnogna82
    • Member since 04-14-2008, 7:32 PM
    • Italy
    • Posts 1

    Hi All,

    after trying something like 10 random workarounds for this issue I finally had it working by just deleting the MACHINENAME/ASPNET user from SQL Server 2005 Express.

    Best regards,
    Dario Rossa

  • Re: Cannot open user default database

    07-04-2008, 9:28 AM
    • Member
      56 point Member
    • safalea
    • Member since 07-02-2008, 9:32 PM
    • Posts 33

     

    monishjain, very clever, you found it

     

    thanks a lotSmile 

  • Re: Cannot open user default database

    07-04-2008, 9:42 AM

    u need to give right to servernmae\aspnet account in sql server.

    it is local account created at the time of iis installtion . iis only request through this account . so this account  should access to sql server. 

    Thanks and Regards
    Somnath
    http://silverlightcsharp.blogspot.com
    Please click “Mark as Answer” on the post if it helps you,
  • Re: Cannot open user default database

    10-10-2008, 6:57 AM
    • Member
      2 point Member
    • tabook22
    • Member since 07-03-2008, 1:55 PM
    • Posts 4

     monishjain..Thanks a lot ..

    Your solution works for me...Thanks a gain

  • Re: Cannot open user default database (en español) :P

    01-23-2009, 10:47 PM
    • Member
      16 point Member
    • freezer27
    • Member since 09-15-2007, 6:48 AM
    • Posts 8

    No se porqué se complican tanto Cool

    Lo q deben hacer es esto (en el web.config):

    <connectionStrings>
            <remove name="LocalSqlServer"/>
            <add name="LocalSqlServer"
            connectionString="Data source=FREEZER\SQLEXPRESS;Initial Catalog=BD_Name;Trusted_Connection=Yes;Integrated Security=True;User Instance=false"
            providerName="System.Data.SqlClient" />
    </connectionStrings>

    <system.web>
    <!-- otras configuraciones -->

    <membership>
                <providers>
                 <remove name="AspNetSqlMembershipProvider"/>
                    <add name="AspNetSqlMembershipProvider"
                     type="System.Web.Security.SqlMembershipProvider"
                     connectionStringName="LocalSqlServer"
                     minRequiredPasswordLength="5"
                     minRequiredNonalphanumericCharacters="0"
                     passwordStrengthRegularExpression=""
                     requiresUniqueEmail="false"
                     requiresQuestionAndAnswer="false"
                     applicationName="/"
            />
                </providers>      
            </membership>

     

    Ojo: la BD q estoy usando está creada y montada directamente sobre el motor de SQL Server (Management Studio), no es un archivo .mdb en la carpeta App_Data, así se puede usar en otras versiones de SQL Server que no sean express (incluso se puede usar con la versión express).

    PD: Otra cosa, hay que crear un usuario llamado ASPNET (Seguridad->Inicios de Sesión ->Nuevo Inicio de Sesión y en el nombre poner ASPNET) y darle permisos de owner a la BD en cuestión y sus respectivos permisos extras, como lo son de select, insert, delete, update y connect, como mínimo).

  • Re: Cannot open user default database

    03-14-2009, 4:57 PM
    • Contributor
      4,611 point Contributor
    • Nemesis116
    • Member since 09-25-2008, 6:09 AM
    • Geel
    • Posts 919
    Thank you monishjain
    Jef Claes
    ~~~~~~~~~~


    Visit my blog
    Let's Twit!
  • Re: Cannot open user default database

    07-07-2009, 3:35 AM
    • Member
      4 point Member
    • suanleba
    • Member since 01-16-2009, 7:43 AM
    • Posts 38

    monishjain:

    Hi,

    I recently stumbled on this problem. After 10 hours of trying various options, I could isolate the solution to this issue.

    Configuration:

    Windows XP Professional, SQL Server 2005, SQL Server Express 2005, Visual Studio .Net 2005, Visual Web Developer.

    Solution: 

    Initially, I added 'machinename/ASPNET' as user to SQL Server Express database engine. I also added it as a user to my application database.  However, it did not work. Utlimately I removed 'machinename/ASPNET 'user from database engine as well as application database.

    I checked the user ASPNET alongwith the Groups it belonged to. And there was the problem.

    So I added ASPNET as a member of SQLServer2005MSSQLUser$server$SQLExpress. And it worked. I could reproduce the issue by removing it from the group again.

    Steps (Windows XP):

    Go to Control Panel -> Administrative Tools -> Computer Management -> Local Users and Groups -> Users -> ASPNET

    Right Click on ASPNET and select Properties

    Go to Member Of tab.

    Click on Add -> Advanced -> Find Now

    Select SQLServer2005MSSQLUsertiny_mce_markerlt;machinename>$SQLExpress

    Click on Ok -> Ok - >Apply

    Close all the windows and reboot your machine. It should work now.

     

     

     

    Thanks a lot. when I searched and found this solution and it solved my login problem in my XP and SQL 2008 express based PC . then I am trying to set up a web server with win server 2k3 and SQL server 2008 installed, since monishjain marked this solution is for XP system, my question is for windows server 2k3, how to solve it? pls help!

  • Re: Cannot open user default database

    07-16-2009, 6:12 AM
    • Member
      44 point Member
    • idex_rob
    • Member since 01-26-2009, 9:46 AM
    • Posts 80

    Anyone trying to solve this error I would recommend trying these steps - I searched for 3-4days solid trying to resolve this..and now I have.


    Firstly My Specs:

    • Windows Server 2008
    • SQL Server 2005
    • Visual Web Developer 2008 Express Edition

    Ok so firstly I developed an application using the ASP.net 3.5 Login controls - I did this on a windows vista machine that was using SQL Server 2008. It worked perfect on local server, but when I uploaded to my main server and published it on my domain I kept recieving the errors:


    Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.

    Also i got the error

    Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.

    And I found my error may be related to:

    You cannot connect to Visual Studio SQL Server Express on a remote Windows XP Service Pack 2-based computer

    I also noticed that inside the Asp.net Configuration website from Visual Web Developer it wouldnt allow me to create new users, or manage users. This was also how i fixed that:


    Here is how I resolved it.


    Step 1 - Check your instance name/connection string.

    Firstly make sure your instance name is the same for both your connection string and your SQL Server. To do this simply check your connection string, identify the instance name e.g.

    <add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True; User Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf" />

    In this case SQLExpress was my instance name - So then go into your SQL Express configuration double click on "SQL Server 2005 Services" inside there you should see "SQL Server (......)" where ...... will be your instance name. - Make sure this matches your connection string.

    Step 2 - Add line to your connection string

    Add <remove name = "LocalSqlServer" /> to your connection string. So you should have something like this


    <connectionStrings>

    <remove name = "LocalSqlServer" />
    <add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True; User Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf" />

    </connectionStrings>


    Step 3 - Make sure your Connection string inside web.config matches your IIS Connection String

    As mentioned above you need to make sure they match up - What I did was go into your IIS Manager - Start --> Administration Tools --> IIS Manager -->Connection Strings

    Make sure the value inside the LocalSqlServer connection string matches that one listed in your web.config file.

    Step 4 - Create  & Configure your applicaiton pool

    Go into your application pools - Start --> Administration Tools --> IIS Manager --> Application Pool

    Create a new Application Pool - Cool it what you want - set the .net framework version to .Net Framework V2.0.5

    Set Managed Pipeline Mode to Integrated - and check the Start Application pool immediately

    Click Ok - And then right click on the Application pool you created in the list and click "Advanced Settings"

    Under "Process Model" change "Identity" to LocalSystem

    Step 5 - Finally - Change Your Applications/Websites Application Pool

    Go into the applicaiton pool containing your website/Application - Once you have found it right click it from the list and click "Change Application Pool" - Once the box opens - change the application pool to the newely created app pool


    That should then resolve your issues.


  • Re: Cannot open user default database

    09-08-2009, 4:09 PM
    • Member
      2 point Member
    • misovec
    • Member since 09-08-2009, 3:51 PM
    • Posts 1

     I had a similiar issue (corrupt MDF file) and solved the problem using the following steps

    Copied corrupted .mdf and .ldf files to a back up location

    I created another project with an empty website.

    In the new project, I selected Website then ASP .NET Configuration and added a user which automatically created another .MDF and .ldf file.

    Refreshed solution explorer and Right clicked the ASP_Data File folder and opened the folder in explorer.

    Opened task manager and stop the following under the processes tab.

    aspnet_state.exe, sqlwriter.exe, sqlservr.exe.

    Browsed to currupt ASP_Data\.MDF file and .ldf file and removed  read only

    Replaced the corrupt .MDF and matching  .ldf (log file) with the new .MDF and .ldf files.

    Rebooted workstation to restart sql and .net state services

    Opened previously corrupted project and was now able to access the ASP.net Web Site Administration Tool Security tab and see the new user that was previously created.

     

Page 2 of 2 (30 items) < Previous 1 2