Unable to connect to SQL database in ASP.NET configuration

Last post 07-28-2009 3:59 PM by gstutton. 5 replies.

Sort Posts:

  • Unable to connect to SQL database in ASP.NET configuration

    07-28-2009, 11:39 AM
    • Member
      1 point Member
    • gstutton
    • Member since 07-28-2009, 11:30 AM
    • Posts 4

     Hi,

    I have been learning Visual C# /Web Developer 2008 Express, and just started asp.net connected to SQL server express 2005. I realised the versions were out of date, so last night updated to 2008 SP1 express editions of all programs.

    Now, when I am in Web Developer and try to click 'ASP.NET configuration' and then the security option it says:

    "There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.

    The following message may help in diagnosing the problem: Unable to connect to SQL Server database."

    I notice in the systray when I try this there are two asp.net development server icons with different ports. I was the under the impression beforehand there was just one.

    I have tried checking SQL server installation, but not sure what I am looking for. The server service seems to be running, I just don't seem to be able to connect. Suspect the problem is some clash between SQL 2005 express and 2008 express, as 2005 probably wasn't uninstalled completely. I don't know where to look for help.

    I use Win XP home edition sp3.

    Many thanks.

  • Re: Unable to connect to SQL database in ASP.NET configuration

    07-28-2009, 1:17 PM
    • Member
      260 point Member
    • lszk
    • Member since 07-18-2009, 6:16 PM
    • Poland
    • Posts 64

    Can you create database from Server Explorer tab?

    Do you have enabled access to sql server by tcp/ip? (SQLServer Configuration Manager)

    Check the sql sever instance name this which is set in VS. It must be the same.


    For ASP.NET Membership try to create the db manually. Run aspnet_regsql.exe located in %SystemRoot%\Microsoft.NET\Framework\v2.0.50727

    Mark as Answer if it is helpful.
  • Re: Unable to connect to SQL database in ASP.NET configuration

    07-28-2009, 2:45 PM
    • Member
      1 point Member
    • gstutton
    • Member since 07-28-2009, 11:30 AM
    • Posts 4

     Hi,

    Sorry for my ignorance. I am new to SQL server express.

    In web developer express I don't see Server Explorer tab (the book I'm reading said use View/Other Windows/Server Explorer, but it's not there). I do have database explorer tab, but it will not let me connect to a database - I get to add new connection and type the default database name ASPNETDB.MDF and it asks me if I want to create it, but then says '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.'

    I have gone into SQLServer Config Manager and enabled Named Pipes and TCP/IP.

    I have gone into Web Developer / Options/Data connections and the SQL server instance name is SQLEXPRESS, which is the same as the name in configuration manager. The server is showing as running in Configuration Manager.

    I have tried running ASPNET_REGSQL.EXE but it fails to connect also. It gives an error 40 message, mentioning named Pipes, but I have now enabled this and still same error.

    Thanks for your help.

  • Re: Unable to connect to SQL database in ASP.NET configuration

    07-28-2009, 3:09 PM
    • Member
      1 point Member
    • gstutton
    • Member since 07-28-2009, 11:30 AM
    • Posts 4

     Found errorlog via other post:

    End of error log is as follows (can provide complete log if needed)

    2009-07-28 19:33:38.60 Server      A self-generated certificate was successfully loaded for encryption.
    2009-07-28 19:33:38.62 Server      Server is listening on [ 'any' <ipv4> 2972].
    2009-07-28 19:33:38.62 Server      Server local connection provider is ready to accept connection on [ \\.\pipe\SQLLocal\SQLEXPRESS ].
    2009-07-28 19:33:38.62 Server      Server named pipe provider is ready to accept connection on [ \\.\pipe\MSSQL$SQLEXPRESS\sql\query ].
    2009-07-28 19:33:38.63 Server      Dedicated administrator connection support was not started because it is disabled on this edition of SQL Server. If you want to use a dedicated administrator connection, restart SQL Server using the trace flag 7806. This is an informational message only. No user action is required.
    2009-07-28 19:33:38.75 Server      The SQL Server Network Interface library could not register the Service Principal Name (SPN) for the SQL Server service. Error: 0x54b, state: 3. Failure to register an SPN may cause integrated authentication to fall back to NTLM instead of Kerberos. This is an informational message. Further action is only required if Kerberos authentication is required by authentication policies.
    2009-07-28 19:33:38.75 Server      SQL Server is now ready for client connections. This is an informational message; no user action is required.
    2009-07-28 19:33:39.28 spid10s     Starting up database 'tempdb'.
    2009-07-28 19:33:39.49 spid13s     The Service Broker protocol transport is disabled or not configured.
    2009-07-28 19:33:39.49 spid13s     The Database Mirroring protocol transport is disabled or not configured.
    2009-07-28 19:33:39.51 spid13s     Service Broker manager has started.
    2009-07-28 19:33:39.52 spid7s      Recovery is complete. This is an informational message only. No user action is required.
    2009-07-28 19:34:27.31 Logon       Error: 15372, Severity: 16, State: 1.
    2009-07-28 19:34:27.31 Logon       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. [CLIENT: <local machine>]
    2009-07-28 19:37:42.93 Logon       Error: 15372, Severity: 16, State: 1.
    2009-07-28 19:37:42.93 Logon       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. [CLIENT: <local machine>]
    2009-07-28 19:39:18.07 Logon       Error: 15372, Severity: 16, State: 1.
    2009-07-28 19:39:18.07 Logon       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. [CLIENT: <local machine>]

    Thanks.

  • Re: Unable to connect to SQL database in ASP.NET configuration

    07-28-2009, 3:31 PM
    Answer
    • Member
      260 point Member
    • lszk
    • Member since 07-18-2009, 6:16 PM
    • Poland
    • Posts 64

    gstutton:

    I have tried running ASPNET_REGSQL.EXE but it fails to connect also. It gives an error 40 message, mentioning named Pipes, but I have now enabled this and still same error.

    After changed this seeting did you restart the sql server service? It is important.

    Look also at this posts. Maybe there you find the right answer. I have never had that error.

    http://social.msdn.microsoft.com/Forums/en-US/sqldatabaseengine/thread/f5eb164d-9774-4864-ae05-cac99740949b 

    http://www.aspdotnetfaq.com/Faq/fix-error-Failed-to-generate-a-user-instance-of-SQL-Server-due-to-a-failure-in-starting-the-process-for-the-user-instance.aspx

    http://www.emadibrahim.com/2007/06/08/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/ 

    Mark as Answer if it is helpful.
  • Re: Unable to connect to SQL database in ASP.NET configuration

    07-28-2009, 3:59 PM
    • Member
      1 point Member
    • gstutton
    • Member since 07-28-2009, 11:30 AM
    • Posts 4

     Hi,

    Thanks for your suggested links. After a lot of trial and error I found the solution from your first link:

    http://social.msdn.microsoft.com/Forums/en-US/sqldatabaseengine/thread/f5eb164d-9774-4864-ae05-cac99740949b

    I tried the following:

    "B) Delete C:\Documents and Settings\USERNAME\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS."

    This seems to have done the trick. I guess it had some data left over from the 2005 SQL express installation that needed removing before the connection with 2008 server would work.

    Anyway, it seems to be working now, so thanks a lot.

Page 1 of 1 (6 items)
Microsoft Communities