View Single Post
  #1 (permalink)  
Old November 8th, 2011, 04:45 PM
BobRoberts BobRoberts is offline
Registered User
Points: 87, Level: 1
Points: 87, Level: 1 Points: 87, Level: 1 Points: 87, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2011
Posts: 18
Thanks: 0
Thanked 2 Times in 2 Posts
Default Configuration Error in Web.config

I ported my site over to a 2008 R2 server using SQL Express 2008. When I run it from http://localhost, I get the login screen. When I enter the login info and click Ok, I get a Configuration Error, with the second "add name" line highlighted in red. The first one appears to run ok. I'm basing the syntax of this line from Appendix B, page 770. The aspnetdb.mdf is still in the site's App_Data folder, but was attached to the SQLEXPRESS database from there, and then given rights to the NET4 user.

Note that the error also says, "Parser Error Message: The entry 'LocalSqlServer' has already been added." I checked the Web.config file, and the word "LocalSqlServer" is only used once.

Here are the two lines - the second one is giving the error (I tried changing the second to completely match the first to the right of the inital catalog, but that didn't get rid of the error):

Code:
<configuration>
  <connectionStrings>
    <add name="BCConnectionString" connectionString="data source=IT-TEST2\SQLEXPRESS;initial catalog=BC; integrated security=SSPI;persist security info=False; Trusted_Connection=Yes" providerName="System.Data.SqlClient" />
  
    <add name="LocalSqlServer" connectionString="data source=IT-TEST2\SQLEXPRESS;Initial Catalog=aspnetdb;Trusted_Connection=True" providerName="System.Data.SqlClient" />
</connectionStrings>
It worked on the production server with the aspnetdb file unattached to SQL. Here is the line from that Web.config file:

Code:
    <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
      providerName="System.Data.SqlClient" />

Last edited by BobRoberts; November 8th, 2011 at 05:00 PM..
Reply With Quote