Saturday, March 31, 2012

web.config error asp.net 2.0

Platform: ASP.NET 2.0 Windows XP

When users click login button on my login form, the following error appears

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 'AAA has already been added.
Source Error:

Line 39: </appSettings>Line 40: <connectionStrings>Line 41: <add name="AAA" connectionString="Server=server;User ID=user;Password=password;Database=db;Persist Security Info=True" providerName="System.Data.SqlClient" />Line 42: </connectionStrings>Line 43: <system.web>

Source File:C:\Inetpub\wwwroot\A_TEST\web.config Line:41

but there is no second "AAA" entry in my web.config file
Any suggestions?
Zura

Hello.
maybe not in that config file...maybe someone has added the same entry to another web.config file placed at another level. check the other config files to see if they don't have that entry on them...
Yes, You are right. There is another web.config file placed at another level. (in the parent directory). But that directory is completly different application. But why this application is accessing web.config in parent directory?

Hello again.
well. you must keep in mind that the configurations applied at a specific level result from the cumulative sum of all the levels. for example, when asp.net processes a page that is placed at the top of you app (ie, a page placed on the top dir of the app), the definitions available at that place come from the web.config placed at that folder + web.config placed at the top root folder+web.config placed at the installation directory+machine.config placed on the installation directory.
it works as if all the declarations made in previous config files were written in the config file placed in the directory you're in...so, if you've already have an application entry with the same name of the web.config file placed on the parent directory, then you'll have to remove the entry before adding it again in the web.config. something like this might help you:
<appSettings>
<remove name="key" />
<add name="key" value="..." />
</appSettings>
hope this helps...

0 comments:

Post a Comment