Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.Net/web.config - "The entry 'x' has already been entered"?

In ASP.Net when I see the error message "The entry 'x' has already been entered" I think that means a name (in this case 'x') is defined twice in Web.Config.

Is that a reasonable summary of what causes that error or are there other ways it could be generated ?

The 'x' in question doesn't appear twice in the web.config - any ideas of what else could be causing this error ?

like image 466
glaucon Avatar asked Nov 30 '22 18:11

glaucon


1 Answers

If you have nested web.config files, the same connection string entry in both web.config files can cause this error. You can fix this by adding a <clear/> tag in the nested web.config file like so:

<connectionStrings>
    <clear/>
    <add name="MyEntities" connectionString="blah,blah,etc." />
</connectionStrings>
like image 166
James Lawruk Avatar answered Dec 25 '22 18:12

James Lawruk