Search This Blog

Thursday, February 19, 2009

"The entry 'ConnectionString1' has already been added" error

I have a fairly involved web application working on my development laptop but when I push it to the client's IIS server I get a perplexing message from IIS when it tried to open a page that made a call to SQL Server -- it claimed that "The entry 'ConnectionString1' has already been added" in the Web.Config file.

An examination of the web.config file showed a single entry for ConnectionString1, no double entries anywhere, so I began walking through the code on the development server line by line in the debugger. No problems.

I went back to the client's server, completely cleared out my code, and then republished it. Got the same error.

A simple file search of the INETPUB directory showed an old WEB.CONFIG file in the root directory, one I'd actually put there months earlier when testing something and neglected to remove. Sure enough, there was the "second" entry for the connection string in there ... I simply deleted the old WEB.CONFIG file in the web root directory and it started working fine.

Another lesson in how important it is to clean up after yourself.

No comments: