Wrox Programmer Forums
|
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 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 March 1st, 2014, 01:28 PM
Authorized User
 
Join Date: Dec 2010
Posts: 27
Thanks: 10
Thanked 0 Times in 0 Posts
Default Connection string problems

Hi Imar.
I am working on a site with the help of your fine book ASP.NET 4 in C# and VB.
It is in fact closely modeled after parts of the Planet Wrox sample site. My site includes so far, besides a membership part, only a photo albums module analogous to the Gig Pics section of Planet Wrox. Later, I want to add something like a newsletter or a diary section.
I use VS2010 and C# for my work on the website. The site is not finished, but works OK on my development machine (membership and photo section parts).
I have my own web server and have moved the site to the server. The URL is http://astak.nes56.net
At first, neither the membership part nor the pics data access worked. After some tweaking of the connection string for the aspnetdb.mdf database, I managed to log into the site. I suspect that I must do something similar for the N56.mdf database as well because when I try to open a photo album, I get this:

Quote:
Format of the initialization string does not conform to specification starting at index 117.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 117.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[ArgumentException: Format of the initialization string does not conform to specification starting at index 117.]
System.Data.Common.DbConnectionOptions.GetKeyValue Pair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) +6374602
System.Data.Common.DbConnectionOptions.ParseIntern al(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +253
System.Data.Common.DbConnectionOptions..ctor(Strin g connectionString, Hashtable synonyms, Boolean useOdbcRules) +134
System.Data.EntityClient.EntityConnection.ChangeCo nnectionString(String newConnectionString) +440
System.Data.Objects.ObjectContext..ctor(String connectionString) +69
System.Web.UI.WebControls.EntityDataSourceView.Con structContext() +547
System.Web.UI.WebControls.EntityDataSourceView.Exe cuteSelect(DataSourceSelectArguments arguments) +147
System.Web.UI.WebControls.ListControl.OnDataBindin g(EventArgs e) +188
System.Web.UI.WebControls.ListControl.PerformSelec t() +51
System.Web.UI.WebControls.BaseDataBoundControl.Ens ureDataBound() +105
System.Web.UI.WebControls.ListControl.OnPreRender( EventArgs e) +35
System.Web.UI.Control.PreRenderRecursiveInternal() +113
System.Web.UI.Control.PreRenderRecursiveInternal() +222
System.Web.UI.Control.PreRenderRecursiveInternal() +222
System.Web.UI.Control.PreRenderRecursiveInternal() +222
System.Web.UI.Control.PreRenderRecursiveInternal() +222
System.Web.UI.Control.PreRenderRecursiveInternal() +222
System.Web.UI.Control.PreRenderRecursiveInternal() +222
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4201
Here is the part of my web.config file that has to do with te connection strings:
HTML Code:
  <connectionStrings>
	  <clear/>
	  <add name="LocalSqlServer" connectionString="Data Source=(local);Initial Catalog=AstaKAspnetdb;User ID=AstaKUser;password=Pa$$w0rD" providerName="System.Data.SqlClient"/>
    <add name="N56Entities" connectionString="metadata=res://*/App_Code.N56.csdl|res://*/App_Code.N56.ssdl|res://*/App_Code.N56.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(local);Initial Catalog=AstaKN56;integrated security=True;" providerName="System.Data.EntityClient" />
    <add name="N56ConnectionString1" connectionString="Data Source=(local);Initial Catalog=AstaKN56;User ID=AstaKUser;password=Pa$$w0rD" providerName="System.Data.SqlClient" />
  </connectionStrings>
I would appreciate if you could give me a hint.
Regards,
__________________
Regards,
Gudni G. Sigurdsson
 
Old March 3rd, 2014, 01:41 PM
Authorized User
 
Join Date: Dec 2010
Posts: 27
Thanks: 10
Thanked 0 Times in 0 Posts
Default Connection string problems

Hi, there.
After trying several things, I finally managed to get the database access OK. In the end, I noticed that I had written N56.csdl etc. instead of App_Code.N56.csdl etc. in the connection string. I must have been under the impression that I had to skip App_Code when moving from my development machine to the server.
__________________
Regards,
Gudni G. Sigurdsson





Similar Threads
Thread Thread Starter Forum Replies Last Post
Connection String aadz5 JSP Basics 1 January 24th, 2005 04:36 AM
Connection string tlamazares SQL Server ASP 1 March 29th, 2004 05:16 PM
Connection String phungleon Dreamweaver (all versions) 1 February 11th, 2004 05:14 AM
Connection String Help. diamond2165 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 November 7th, 2003 06:09 AM
ASP.NET MSDE Connection string problems Bagheer Classic ASP Databases 0 August 27th, 2003 08:02 PM





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