Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 29th, 2011, 02:26 PM
Registered User
Points: 35, Level: 1
Points: 35, Level: 1 Points: 35, Level: 1 Points: 35, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2011
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
Default Failed to generate user instance of SQL Server

Imar,

I am running Windows XP Home Edition SP3, Microsoft SQL Sever 2008 R2 Express and Microsoft Visual Web Developer 2010 Express.

Here is the problem:

I succeeded in copying PlanetWrox.mdf to App_Data, but when I clicked on it, I go the following error message:

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.

Here is the connection string:

Data Source=.\SQLEXPRESS;AttachDbFilename="C:\Documents and Settings\Alfre\My Documents\Visual Studio 2010\WebSites\WebSite1\App_Data\PlanetWrox.mdf";In tegrated Security=True;User Instance=True

I suspect the problem that I am having has to do with the way that I configured the SQL Server, since I am a novice. From the SQL Server Configuration Manager, I see the SQLEXPRESS service is running under .\Alfre, which is an XP Limited Account.

I appreciate any help that you can give me regarding this.

Regards,
Al Rodriguez
Reply With Quote
  #2 (permalink)  
Old January 30th, 2011, 05:48 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

The problem might be caused by the location of the database. Notice how you have it under your Documents folder where it may not be accessible to other accounts.

Try moving the site to a location like the one suggested in the book (such as C:\BegASPNET\Website1) and try again. Does it work then?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #3 (permalink)  
Old January 30th, 2011, 12:05 PM
Registered User
Points: 35, Level: 1
Points: 35, Level: 1 Points: 35, Level: 1 Points: 35, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2011
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Imar,

Thanks for your prompt response. I tried your suggestion, but to no avail. Here is additional information from the log file:

2011-01-30 10:33:58.64 Logon Error: 15372, Severity: 16, State: 1.
2011-01-30 10:33:58.64 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>]

Could the problem be related to the fact that the running instance of SQLEXPRESS service logs on as .\Alfre, an XP limited account? Is that the correct way to configure it?

Here is the new connection string:

Data Source=.\SQLEXPRESS;AttachDbFilename=C:\BegASPNET\ testWebsite1\App_Data\PlanetWrox.mdf;Integrated Security=True;User Instance=True
Reply With Quote
  #4 (permalink)  
Old January 30th, 2011, 01:54 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Quote:
Is that the correct way to configure it?
By default, SQL Server runs under the Network Service account. You could try that and see if it helps.

A few other tips:

1. Make sure the account used by SQL Server is able to read from and write to the App_Data folder as instructed in the book.

2. Try removing the User Instance attribute from the connection string and see if that helps.

3. Search Google for the exact error message you're getting. It's a common error with - unfortunately - many resolutions so it's hard to give exact advice here. Reading some articles about the problem and its solutions may put you in the right direction.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #5 (permalink)  
Old January 30th, 2011, 06:21 PM
Registered User
Points: 35, Level: 1
Points: 35, Level: 1 Points: 35, Level: 1 Points: 35, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2011
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
Default

I removed the User Instance attribute from the connection string and it worked, although I am not sure why.

Then I tried to create a SQL database from scratch using the template in VWD 2010 Express, I received a similar error, which I was able to correct by deleting the directory “c:\Documents and Settings\alfre\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS and rebooting. I hope this helps someone else and thanks a lot for our assistance.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 18 - Failed to generate a user instance of SQL Server - aspnetdb only SeanCunningham BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 November 2nd, 2010 03:55 AM
Failed to generate a user instance of SQL Server naeem.net SQL Server 2005 3 December 11th, 2009 02:45 PM
Chapter 18: Getting "Failed to generate a user instance of SQL Server" error HungryCaterpillar BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 5 November 11th, 2009 01:56 PM
Failed to generate a user instance of SQL Server Qiaona Jin BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 2 January 2nd, 2009 09:17 AM
SQL Server / Login failed for user 'NT AUTHORITY ElPato ASP.NET 1.0 and 1.1 Basics 2 November 14th, 2004 10:03 AM



All times are GMT -4. The time now is 12:52 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.