ASP.Net/web.config - "Is the entry" x "already entered?"

In ASP.Net, when I see the error message " Record" x "is already entered " I think this means that the name (in this case, "x") is defined twice in Web.Config .

Is this a reasonable summary of what causes this error, or are there other ways to create it?

Question "x" does not appear twice in the web.config file - any ideas on what else might cause this error?

+4
source share
4 answers

If you have attached web.config files, the same connection string line in both web.config files can cause this error. You can fix this by adding the <clear/> to the attached web.config file as follows:

 <connectionStrings> <clear/> <add name="MyEntities" connectionString="blah,blah,etc." /> </connectionStrings> 
+15
source

Perhaps you have nested Web.configs. If you use multiple applications from the same directory hierarchy, you can see this. For example, let's say you have IIS pointing to the root of some directory, but there is a folder with another application inside this directory, and you have vdir pointing to this application - you can really run into this problem, because ASP. Net will check first web.config in the root, and then web.config for the application that vdir points to.

+5
source

+1 for Erica's answer. Also, if you are updating web projects (i.e., from VS 2008 to VS 2010), the web.config file that it stores for you in the backup folder causes this error for the same reason.

+1
source

I saw how this happens when the virtual directory inherits settings from the root site. Check if the other parent.config file contains the AppSettings key.

0
source

All Articles