Adsense

Wednesday, May 27, 2009

‘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

2 comments:

TiTi said...

I have a problem with web.config when I set myapp folder to virtual directory, the message below:

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: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

Source Error:

Line 29:
Line 30:
Line 31:
Line 32:
Line 33:


Source File: C:\inetpub\wwwroot\vectweb\web.config Line: 31

But,if I run it from visual studio 2010, it's okay!, so I don't know for sure what happen with my configuration, Any idea please?

Paul Fox said...

It sounds like you have more of a problem with your setup in IIS than with the configuration of your application. Are you sure you want to create a virtual directory? Or is it an IIS application you want to create?