Saturday, January 10, 2009

Error: Connection string already added



Server Error in '/BabuTest' Application.



Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request.
Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: The entry 'SiteSqlServer' has already been added.

Source Error:





Line 23:       providerName="System.Data.SqlClient" />-->
Line 24: <!-- Connection String for SQL Server 2000/2005-->
Line 25: <add name="ConnectionString" connectionString="Server=(local);
Database=babu
uid=sa;pwd=sa12345678;" providerName="System.Data.SqlClient"/>
Line 26: </connectionStrings>
Line 27: <appSettings>


Source File: c:\inetpub\wwwroot\dnntest\web.config Line: 25





Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42



This is the config error i get. Has anyone experienced this problem?



// Moderator edit to reduce scroll



How to solve the Issue

The common cause for the error is the connecting string name
name="ConnectionString" already is present in
the machine.config file.

It is default in the machine.config file.

The best way of giving the name of the connection string is
project Name + ConnString

Or if the problem still exists.

<connectionstrings>
<clear>
<!-- OR -->
<remove name="SiteSqlServer">
<add name="SiteSqlServer" connectionstring="..."
providername="System.Data.SqlClient"></add>
</connectionstrings>

No comments: