‘The configuration section 'connectionStrings' cannot be read because it is missing a section declaration’ message in IIS7

I spent the better part of this morning trying to figure out what was wrong with a 3rd party blogging utility that we recently started using. I was getting and error message stating that “The configuration section 'connectionStrings' cannot be read because it is missing a section declaration” when setting up my development environment.

The ONLY reference to this error that I could find was from MSDN HERE. No sections of the web.config were encrypted so, none of the recommended causes and resolutions helped.The web.config file for the 3rd party project was pretty large and I thought it might have been due to mal-formed xml somewhere. I validated the xml and scanned for anything obvious, but it all looked like everything was fine.

I eventually tracked down the problem with the web.config file. The problem was in the <configSections> section of the web.config. The 1st line within this section was <clear/>. The <clear/> tag can be used to removes all sections and section groups that were already defined (either earlier in the given configuration file or higher in the configuration hierarchy.) This is helpful in other sections when you want to clear a default provider before registering a new one, etc…

It looks like <clear/> is a valid tag for this section, so I’m not sure why it would be causing the error. Either way it solved my problem for my development environment. Hope this helps someone else in the future.

~ Paul

0 comments :: ‘The configuration section 'connectionStrings' cannot be read because it is missing a section declaration’ message in IIS7