I am creating asp.net forms authentication. When I run web site and there I try to create new user I get this error:
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.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
SQLExpress database file auto-creation error:
The connection string specifies a local Sql Server Express instance using a database location within the applications App_Data directory. The provider attempted to automatically create the application services database because the provider determined that
the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database:
If the applications App_Data directory does not already exist, the web server account must have read and write access to the applications directory. This is necessary because the web server account will automatically create the App_Data directory if it
does not already exist.
If the applications App_Data directory already exists, the web server account only requires read and write access to the applications App_Data directory. This is necessary because the web server account will attempt to verify that the Sql Server Express
database already exists within the applications App_Data directory. Revoking read access on the App_Data directory from the web server account will prevent the provider from correctly determining if the Sql Server Express database already exists. This will
cause an error when the provider attempts to create a duplicate of an already existing database. Write access is required because the web server accounts credentials are used when creating the new database.
Sql Server Express must be installed on the machine.
The process identity for the web server account must have a local user profile. See the readme document for details on how to create a local user profile for both machine and domain accounts.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x80131904): 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.]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846887
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +35
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +144
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +342
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +221
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +189
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +4861315
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +29
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +4863644
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
System.Data.SqlClient.SqlConnection.Open() +122
System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +82
[HttpException (0x80004005): Unable to connect to SQL Server database.]
System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +137
System.Web.Management.SqlServices.SetupApplicationServices(String server, String user, String password, Boolean trusted, String connectionString, String database, String dbFileName, SqlFeatures features, Boolean install) +94
System.Web.Management.SqlServices.Install(String database, String dbFileName, String connectionString) +25
System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName, String dataDir, String connectionString) +395
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.
you might need to delete the C:\Documents and Settings\username\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS directory.
Then restart ur machine.
Hope that helps [Yes]
PassHours We make a living by what we get, but we make a life by what we give. ::: Winston Churchill :::
In the far meantime I solved this problem. I deleted sqlexpress directory, as mentioned above. But for this I logged as an administrator and in command prompt I got there...
Thanks for the help. For those reading this forum and wanting to accomplish the same thing on Vista, delete this directory instead : C:\Users\username\AppData\Local\Microsoft\Microsoft SQL Server Data\SQLEXPRESS
Thanks so much for the help. I wrestled for ages with this - I think perhaps part of the problem was that I had downgraded from SQLExpress 2008 (although I had been having problems with that too).
I found that for asp.net to create a user instance, I also had to delete:
C:\Documents and Settings\<machine name>\ASPNET\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data.
I am having this same problem, and it seems that this forum is close to helping everyone find an answer.
I am working on VISTA .x64 Ultimate SP2, with Visual Studio 2008 SP1 and I also have SQL Server (Express) 2008 installed. I upgraded from SQL Server Express 2005. In the SS Management Studio I can access all of the databases as required, including the problematic
one called BOI_DB (BOI_DB.mdf), without any issues. I can also see all tables, sp etc., and edit any of them as desired, again without issues.
In Visual Studio however, I cannot create new database files. When I right-click on my app's App_Data folder and choose "Add New Item...", then select Sql Server Database, I get an error message:
"Connections to SQL Server files (*.mdf) require SQL Server Express 2005 to function properly. Please verify the installation of the component or download from the URL: ..."
In addition to the above, when my ASP.NET 3.5 web app tries to add a record to this database, I get this error:
"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."
and the app fails.
I have tried many of the solutions displayed in this thread, but nothing seems to be working. Can someone please help me to find a solution to this frustrating problem. I've been on it for days and I am just not getting anywhere. Thanks for your help in
advance.
matejkralik
Member
11 Points
41 Posts
Failed to generate a user instance of SQL Server
Jan 28, 2009 09:55 PM|LINK
I am creating asp.net forms authentication. When I run web site and there I try to create new user I get this error:
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.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
SQLExpress database file auto-creation error:
The connection string specifies a local Sql Server Express instance using a database location within the applications App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database:
Source Error:
Stack Trace:
Could you please give me advice what to do?
rudy1094
Member
61 Points
35 Posts
Re: Failed to generate a user instance of SQL Server
Apr 04, 2009 03:31 AM|LINK
Foolish question, but do you have sql server installed on your machine?
PassHours
Contributor
4322 Points
736 Posts
Re: Failed to generate a user instance of SQL Server
Apr 04, 2009 05:49 AM|LINK
you might need to delete the C:\Documents and Settings\username\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS directory.
Then restart ur machine.
Hope that helps [Yes]
We make a living by what we get, but we make a life by what we give.
::: Winston Churchill :::
matejkralik
Member
11 Points
41 Posts
Re: Failed to generate a user instance of SQL Server
Apr 04, 2009 06:29 PM|LINK
In the far meantime I solved this problem. I deleted sqlexpress directory, as mentioned above. But for this I logged as an administrator and in command prompt I got there...
thanks anyway
babuji_godem
Member
109 Points
57 Posts
Re: Failed to generate a user instance of SQL Server
Jun 03, 2009 11:05 AM|LINK
If you are using the membership provider and web parts, the connection string name should be LocalSqlServer
Human Logic Pvt Ltd.
ribald
Member
8 Points
4 Posts
Re: Failed to generate a user instance of SQL Server
Jun 17, 2009 07:01 PM|LINK
Liste
Member
74 Points
60 Posts
Re: Failed to generate a user instance of SQL Server
Jul 02, 2009 03:31 PM|LINK
Thanks for the help. For those reading this forum and wanting to accomplish the same thing on Vista, delete this directory instead : C:\Users\username\AppData\Local\Microsoft\Microsoft SQL Server Data\SQLEXPRESS
Again, Thanks!
Liste
TerryH99
Member
2 Points
1 Post
Re: Failed to generate a user instance of SQL Server
Jul 23, 2009 07:05 PM|LINK
Thanks so much for the help. I wrestled for ages with this - I think perhaps part of the problem was that I had downgraded from SQLExpress 2008 (although I had been having problems with that too).
I found that for asp.net to create a user instance, I also had to delete:
C:\Documents and Settings\<machine name>\ASPNET\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data.
Hope this saves someone some pain!
suhakranthi
Member
2 Points
1 Post
Re: Failed to generate a user instance of SQL Server
Jul 29, 2009 09:37 AM|LINK
Thanks a lot. I didn't had clue until i read ur article. I'm trying implement asp.net membership roles in sharepoint and got stuck with this error.
I changed the connection string name to "localsqlserver" . It worked..
opcode901
Member
17 Points
15 Posts
Re: Failed to generate a user instance of SQL Server
Sep 27, 2009 05:33 PM|LINK
I am having this same problem, and it seems that this forum is close to helping everyone find an answer.
I am working on VISTA .x64 Ultimate SP2, with Visual Studio 2008 SP1 and I also have SQL Server (Express) 2008 installed. I upgraded from SQL Server Express 2005. In the SS Management Studio I can access all of the databases as required, including the problematic one called BOI_DB (BOI_DB.mdf), without any issues. I can also see all tables, sp etc., and edit any of them as desired, again without issues.
In Visual Studio however, I cannot create new database files. When I right-click on my app's App_Data folder and choose "Add New Item...", then select Sql Server Database, I get an error message:
"Connections to SQL Server files (*.mdf) require SQL Server Express 2005 to function properly. Please verify the installation of the component or download from the URL: ..."
In addition to the above, when my ASP.NET 3.5 web app tries to add a record to this database, I get this error:
"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."
and the app fails.
I have tried many of the solutions displayed in this thread, but nothing seems to be working. Can someone please help me to find a solution to this frustrating problem. I've been on it for days and I am just not getting anywhere. Thanks for your help in advance.
Opcode901