Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| 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 February 28th, 2012, 01:14 PM
Authorized User
Points: 134, Level: 2
Points: 134, Level: 2 Points: 134, Level: 2 Points: 134, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2012
Posts: 22
Thanks: 0
Thanked 4 Times in 4 Posts
Default Problems with chapter 12

Can not get access to PlanetWrox.mdb file have tired adding in the App_data folder but it just keeps giving me the same 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.

now I can connect to my own data bases on my Edition of SQl Server 2008r2 express so how can i add this data base to it?
Reply With Quote
  #2 (permalink)  
Old February 28th, 2012, 03:00 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: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

Did you install SQL Server Express 2008 R2 using the Web Platform Installer? And can you address it using .\SqlExpress in, for examle, SQL Server Management Studio? It should work with this setup. You may find more information and a fix in this thread: Problem using SQL Server Express 2008

That said, you could also attach the database to SQL Server. Move it to a folder outside your web site (e.g. C:\Databases or whatever) and then follow instructions in Appendix B that shows you how to attach the database to SQL Server.

I would look at the thread I linked to first though, as that would probably solve the problem for good.

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
  #3 (permalink)  
Old March 3rd, 2012, 06:49 PM
Authorized User
Points: 134, Level: 2
Points: 134, Level: 2 Points: 134, Level: 2 Points: 134, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2012
Posts: 22
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Hello all I thought I’d share my experiences here for the benefit of others

Frist off I am using Window XP pro service pack 3 (32 bit)
Visual Web Developer Express 2010 service pack 1
SQL Server 2008r2 with advanced tools

I tried and tried to get it to work the books way with no success. Have had some experience with all of this before, so I tried it another way. Here is what I did

I went to the Database Explorer right clicked on Data Connections and chose add new connection you get the following dialog box.

Add Connection (slight aside would be nice to be able to post pictures here of the dialog box for better explanation)

Chose my SQLExpress in the Server Name drop down list
The check “Use Windows Authentication” Then Chose “Attach Database File”
Hit the browse button and located my downloaded file from the resource folder. Then Hit Ok.

That worked fine also automatically put the database in my Sql sever with it’s location being where a downloaded the file sits neat.

This worked fine for me until I reached chapter 14 and the second try it out
When I did the first try it out in Chapter 14 it added another copy of the database to my Data Connections in Data Explorer.

Both connections where working fine till I shut down Visual studio by accident and open it up again When I clicked on the second database connected to the Entity object got that same dreaded 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.

I continued to work because everything was working because of the copy database was working that I created with the add connection method. I created the two new tables then went to add them to the PlanetWrox.edmx and to my surprise they where not there.
So here I am stumped once again so I follow the link so kindly provided by Imar in this thread.


That lead me to this post

http://www.aspdotnetfaq.com/Faq/fix-...-instance.aspx

I ran this query from that post

exec sp_configure 'user instances enabled', 1.
Go
Reconfigure

Then restarted SQL

I did not have to delete any of the files that same thread discussed just using the query seems to work.

Now everything seems to work fine with one exception I now have two copies of the planet wrox database in my website solution. They seem to be totally independent of each other so now I must make update to two databases to get everything to work. Do not know if this will solve future problems but I will keep everyone posted because when I finish this book I plan to reread it and rebuild the PlanetWrox site all over from scratch.

Any comments anyone has about all of this would be nice to hear
Reply With Quote
The Following User Says Thank You to happyandstable For This Useful Post:
Imar (March 6th, 2012)
  #4 (permalink)  
Old March 6th, 2012, 06:06 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: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Thanks for the update! Much appreciated; hopefully that's going to help someone some day.

Would be interesting to see what happens when you go through the book again. Do you intend to start with a clean install of VS / SQL Server? Part of the issues you were facing may be related to the initial setup of this software.

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 March 6th, 2012, 09:01 PM
Authorized User
Points: 134, Level: 2
Points: 134, Level: 2 Points: 134, Level: 2 Points: 134, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2012
Posts: 22
Thanks: 0
Thanked 4 Times in 4 Posts
Default

The problem persist, I shut down Visual Web Developer Express and when I started it again no access to my entity database.

So I did step 2 from the previous post
I deleted the contents of

C:\Documents and Settings\YOUR_USERNAME\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS

Then I created and empty web site, added a app_data folder.

Then Choose add new item and choose SQL Server Database.

Now everything works just fine I can close down and open up visual web Developer and both databases are there and usable, no more

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

So this is the final fix everything works and things are great hope this helps others with this problem.

Once again the link to the solution is

http://www.aspdotnetfaq.com/Faq/fix-...-instance.aspx
Reply With Quote
The Following User Says Thank You to happyandstable For This Useful Post:
Imar (March 7th, 2012)
  #6 (permalink)  
Old March 7th, 2012, 11:28 AM
Authorized User
Points: 134, Level: 2
Points: 134, Level: 2 Points: 134, Level: 2 Points: 134, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2012
Posts: 22
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Final thoughts on the dreaded

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


It is clearly not a SQL sever problem but a Visual Studio problem. It is also not a bug so there will never be a fix for it. It is the program acting the way it was designed to. To explain all of this I will give you the history of my install process. I first installed visual web developer 2010 express. And yes I did use the windows installer. For all installations. When I downloaded Visual Web Developer 2010 it installed SQL Server 2008 Express as well. Now this version of SQL does not come with the proper management tools like SQL Server Management Studio to do all the administration task one needs to do with SQL. So after some using of Visual Studio Web developer I need to load the SQL Server Management Studio. I was still having problems with some of the things I was suppose to be able to do in Visual Web Developer with SQL so after some research I found out you needed to add the SQL Full Text Daemon Launcher to get things to work.

In the process of finding that out I came across some post that said you should install SQL Server 2008r2 Express with advance services

http://www.microsoft.com/download/en....aspx?id=25174

to get everything you need in one package. So I uninstalled SQL Server 2008 Express and installed SQL Server 2008r2 with advance services. This is when I started to get the dreaded

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

The reason I was getting this is because it was still looking for the original version of SQL installed when I first Installed Visual Web Developer 2010 Express.

I was able to continue working with various work arounds. Even after I created and Entity model and kept losing my connection to my Entity database. I would right click on the Entity data base and chose Modify connection and choose my installed Version of SQL Express and it would work for me as long as I did not close the Visual Web Developer App.

In the process of poking around I noticed that there was two different version of the same database. One I established first with the Add data connection method described in an earlier post from me in this thread. The other when I created the Entity Object. One was stored In my download location for the books code the other was installed in the App_Data file of Visual Web Developer. This was the database the kept giving me the error message. And the reason was it was still looking for the old SQL Server 2008 install to run the database (I was now using SQL Server r2)

At this point I am not so sure you need to run the Query just deleting the files and then creating a empty project and add a SQL Data Server in the App_Data folder would work. Because this connection is carried from project to project by Visual Studio and stored in the UserName folder of each user, as explined in my earlier post in this same thread. I have done that now I have no problems with my database connections from project to project I can open and close them and everything works just fine. So in conclusion Visual Web Developer 2010 Express maintains your database connection from project to project unless you change it in the manner explained. So if you are using computers with multiple users all you have to do is follow these instruction to the letter and it should work every time you log into you workstation under your username.

http://www.aspdotnetfaq.com/Faq/fix-...-instance.aspx

If anyone else has anything to add I would love to hear your thoughts Happy Coding all.

Last edited by happyandstable; March 7th, 2012 at 11:31 AM..
Reply With Quote
The Following User Says Thank You to happyandstable For This Useful Post:
Imar (March 9th, 2012)
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
Chp 12: Problems with htpasswd DMatt BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 1 August 3rd, 2010 11:53 AM
Errors on Chapter 12 example(12.8) sonnie ASP.NET 2.0 Professional 2 June 7th, 2006 10:55 AM



All times are GMT -4. The time now is 01:04 AM.


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