Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5.1: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-84677-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5.1 : 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 May 7th, 2015, 10:13 AM
Registered User
 
Join Date: May 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default database connection error when use IIS

Hi Imar,

I'm a beginner of ASP.NET and your book is really helpful to me,but I met a problem in chapter 19
In chapter 19,after configuring the file system,my SQL server instance name is MSSQLSERVER(as default),so I changed the connection string as follow:
connectionString="Data Source=.\MSSQLSERVER;AttachDbFilename=|DataDirecto ry|\PlanetWrox.mdf;Integrated Security=True;"
(so is the entity framework's connection string, changed the Data Source value)

but when it runs under IIS by typing localhost,it occurs an error when choose
a DB-related page,like Gig Pics:
provider: SQL Network Interfaces, error: 25 - connection string is invalid
when use VS's IIS Express to run the sites it also shows the error
so I enabled the Name Pipes and TCP/IP protocols using SQL Server Configuration Manager as Appendix,and turn off the firewall, but the error still occur, and I tried to change the Data Source value back to "(LocalDB)\v11.0", it run right when using IIS Express,but when run under IIS,it still occur that error when select some pages,so it's really confusing me(I use VS2013,data base is SQL 2012 standard edition)
Thank you
Yan

Last edited by ninevehland; May 7th, 2015 at 10:27 AM..
 
Old May 8th, 2015, 03:28 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Take a look at Appendix B on how to configure SQL Server. If you're using the full version, you need to attach the database to SQL Server and then use Initial Catalog=DatabaseName instead of using the AttachDbFilename attribute with a local file reference.

Hope this helps,

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 May 11th, 2015, 04:23 AM
Registered User
 
Join Date: May 2015
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Make the following corrections
datasource





Similar Threads
Thread Thread Starter Forum Replies Last Post
Database connection error lappling General .NET 0 April 20th, 2006 07:48 AM
IIS server, connection to offsite database server Hazzardusa Classic ASP Databases 1 August 14th, 2005 10:03 PM
Database Connection Error werD420 Classic ASP Databases 12 January 20th, 2005 01:52 PM





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