stringo0
stringo0

Reputation: 2760

asp.net SQL Database File Error

We're getting the following error when trying to establish a connection to a database file in the project:

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.

Any ideas on how we can fix it?

Thanks in advance!

Upvotes: 1

Views: 182

Answers (4)

Shachi
Shachi

Reputation: 1888

If you are using IIS as the server,then this occurs because the server takes default asp.net database. In IIS server,create your own application pool and run your app on that instead of using the default pool.

Check the permissions.Give full access control rights.

Also, go to SQL server configuration>properties. Select local system in the built-in app.. And your new pool should also have local system selected.

This fixed the problem for me. Hope it works for someone here.

PS: If you are trying to making connectivity in Visual studio for android application,then close the visual studio before running it on android as the process wont complete if visual studio is open and will result into error.

Upvotes: 1

stringo0
stringo0

Reputation: 2760

We got over this by copying the database from my machine to my team-mate's.

Upvotes: 0

Remus Rusanu
Remus Rusanu

Reputation: 294367

SQL Express file attach starts a new 'user instance' SQL Server. This involves a new master/model/msdb/tempdb set of files that are created in the user settings data folder. also the startup of the new 'user instance' can take up to several minutes on extreme cases.

This MSDN article on SQL Server 2005 Express Edition User Instances cover in detail the process and luckly it has some Common Issues and fixes. The most common failure is due to access rights over the user settings copied files. You will usualy get details about the failure in your NT event log (ie. why did the child instance not start).

Upvotes: 0

Kelly Robins
Kelly Robins

Reputation: 7313

http://jeremywadsworth.com/Default.aspx?blogentryid=56 has one possible fix.

http://forums.asp.net/t/1377174.aspx also has further discussion on the topic.

Hope that helps.

--

One more idea. I think I've encountered something like this when using Visual studio to create and access my database. You can detach your database file from visual studio and then directly attach it to your SQL server. I can't remember if the problem manifested in the same way or not but this should get you around the user instance issue. If this doesn't apply let me know and I'll see if i can come up with anything else.

Upvotes: 1

Related Questions