Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5 > BOOK: Beginning ASP.NET 4.5 : in C# and VB
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4.5 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-31180-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 10th, 2013, 06:46 AM
Registered User
Points: 37, Level: 1
Points: 37, Level: 1 Points: 37, Level: 1 Points: 37, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2013
Location: Sydney
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Post Chapter 19: Configuring the File System (unable to open DB)

I am in chapter 19 (page 757), configure the filesystem for the website.

Quote:
To check if the site works, open a browser and go to http://localhost. You should see the Planet Wrox website appear. To verify that everything is in order, browse through the site by requesting pages from the main menu, fi lling in the contact form, creating a new album, uploading pictures, and so on. If you get an error, refer to the section “Troubleshooting Web Server Errors.”
When I try http://localhost, I can see the home page, but browsing to other pages specially where DB access required, I get this error:

Quote:
The database 'C:\BEGASPNET\RELEASE\APP_DATA\PLANETWROX.MDF' cannot be opened because it is version 706. This server supports version 662 and earlier. A downgrade path is not supported.
All the pages works from Visual Studio IDE (2012 Professional).

Googling shows site attached to SQL Server 2012, so unable to downgrade.

Hope I have not missed any steps. Any suggestions to resolve this issue.

Thanks
 
Old September 10th, 2013, 11:13 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Sounds like there's a mismatch in SQL Server version. To which version of SQL Server are you attaching this database?

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!
 
Old September 10th, 2013, 11:20 PM
Registered User
Points: 37, Level: 1
Points: 37, Level: 1 Points: 37, Level: 1 Points: 37, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2013
Location: Sydney
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Default

In my machine, SQL server 2008 & 2012 installed.

I want to attach DB to SQL server 2012. Tried to attach using SSMS (SQL Server Management Studio) 2012 but failed to attach, looks like it attached to 2008. Not sure yet how to check which version the DB attached to.

I can not see SSMS under All Programs - Microsoft SQL Server 2008. Any idea how to detach the DB.

In chapter 19, I have followed earlier steps to copy the site to release folder, looks like somehow it attached to earlier version of SQL server.
 
Old September 12th, 2013, 10:30 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You'll need to modify your connection strings to target the SQL Server 2012 database. Appendix B has more details.

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!
 
Old September 16th, 2013, 04:09 AM
Registered User
Points: 37, Level: 1
Points: 37, Level: 1 Points: 37, Level: 1 Points: 37, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2013
Location: Sydney
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks for your suggestions. I have followed Appendix B to create user, set database role.

Now gets different error:
[SqlException (0x80131904): Login failed for user 'PlanetWroxUser'.]

I have double checked user name, password, even created another user but same error.

Here is my connection strings:

Quote:
<connectionStrings>
<add name="PlanetWroxConnectionString1" connectionString="Data Source=.\SqlExpress;Initial Catalog=PlanetWrox;User ID=PlanetWroxUser;password=Pa$$w0rD" providerName="System.Data.SqlClient" />
<add name="PlanetWroxEntities" connectionString="metadata=res://*/App_Code.PlanetWrox.csdl|res://*/App_Code.PlanetWrox.ssdl|res://*/App_Code.PlanetWrox.msl;provider=System.Data.SqlCl ient;provider connection string=&quot;Data Source=.\SqlExpress;Initial Catalog=PlanetWrox; User ID=PlanetWroxUser;password=Pa$$w0rD;MultipleActive ResultSets=True&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>
Screen cast of SSCM: http://screencast.com/t/8Lc0VHnx

Hope its not a environmental issue.
 
Old September 16th, 2013, 06:44 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Did you configure SQL Server for SQL Server Authentication? The default is Windows security only.

Also, did you add the user as both a Login to the server and a User to the database?


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!
 
Old September 17th, 2013, 06:57 AM
Registered User
Points: 37, Level: 1
Points: 37, Level: 1 Points: 37, Level: 1 Points: 37, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2013
Location: Sydney
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Quote:
Did you configure SQL Server for SQL Server Authentication? The default is Windows security only.
Yes, screencast: http://screencast.com/t/hlJicp26

Quote:
Also, did you add the user as both a Login to the server and a User to the database?
Yes, screencast: http://screencast.com/t/cf5qewAv
 
Old September 17th, 2013, 11:43 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Take a look at the first image you posted. The title bar says (localdb)\v11.0 while your connection strings target SqlExpress. Looks like you're configuring an incorrect instance of SQL Server.

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!
 
Old September 18th, 2013, 07:01 AM
Registered User
Points: 37, Level: 1
Points: 37, Level: 1 Points: 37, Level: 1 Points: 37, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2013
Location: Sydney
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks for your response. I have tried the server name "(localdb)\v11.0" before and was getting server not found error then I used SqlExpress.

With server name, I get following errors.

Stack Trace
Quote:
...
[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
)]
System.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +6676046
System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +810
...
Event viewer log...
Quote:
Cannot get a local application data path. Most probably a user profile is not loaded. If LocalDB is executed under IIS, make sure that profile loading is enabled for the current user.
connectionStrings
Quote:
<add name="PlanetWroxConnectionString1" connectionString="Data Source=(localdb)\v11.0;Initial Catalog=PlanetWrox;User ID=PlanetWroxUser;password=Pa$$w0rD" providerName="System.Data.SqlClient" />
<add name="PlanetWroxEntities" connectionString="metadata=res://*/App_Code.PlanetWrox.csdl|res://*/App_Code.PlanetWrox.ssdl|res://*/App_Code.PlanetWrox.msl;provider=System.Data.SqlCl ient;provider connection string=&quot;Data Source=(localdb)\v11.0;Initial Catalog=PlanetWrox; User ID=PlanetWroxUser;password=Pa$$w0rD;MultipleActive ResultSets=True&quot;" providerName="System.Data.EntityClient" />
As a beginner, the issue could be something simple I have missed. All sites works fine from VS 2012, only the release is not working.
 
Old September 18th, 2013, 09:12 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

LocalDB is designed to be used during development, and not for production (which is what you're doing when hosting it in IIS, even if it's just on your local machine).

There are a few ways to resolve this:

1. Keep using LocalDB and do as the error message says by loading the user profile. You find this setting on the Applicaton Pool in IIS. It's under Advanced Settings and its called "Load User Profile".
You should see this solution as a work around on your local machine only.

2. Switch to SQL Server / SQL Server Express. First, try logging in to SQL Server Express using SQL Server Management Studio. The correct name for an Express instanc eis .\SqlExpress. If that fails, SQL Express may not be installed so you need to do that first. Once SQL Express is installed, follow the steps for configuring the user account and roles again and then modify your connection strings so they target .\SqlExpress instead of (localdb)\v11.0. You also need to attach your databases to SQL Server first.

Chapter 19 and Appendix B have all the details. Let me know when you get stuck by posting here with the path you've chosen and a detailed description of your problems.

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!
The Following User Says Thank You to Imar For This Useful Post:
Happs (September 22nd, 2013)




Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with using ASP.NET Configuration (Chapter 19 Configuring Security: Ex 13) TJinWI BOOK: Beginning Visual C# 2012 2 April 17th, 2014 11:48 AM
Chapter 18, Configuring the File System jsymons BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 October 1st, 2009 02:08 PM
Configuring the file system page 653 normowen BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 November 15th, 2008 07:14 PM
Unable to open ProjectTimeTracker DB cancer2006 BOOK: Beginning VB.NET Databases 2 October 24th, 2006 03:53 PM
Unable to open script file Pickle Dreamweaver (all versions) 1 October 31st, 2005 02:35 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.