How to create configurationSections in EntLib 3.1?

Topics: General discussion
Jun 18, 2007 at 2:58 PM
I have a global assembly in my webserver GAC (named BLL.dll) which has EntLib 1.1 references. I have dozens of websites on the same webserver, which reference BLL.dll and also have EntLib 1.1 references. I am now upgrading the websites to use EntLib 3.1. I am not upgrading the global assembly BLL.dll because I am not yet able to do so. I've added the necessary EntLib 3.1 references to my first website, but if I execute a method in BLL.dll(which is still using EntLib 1.1), I get the following exception:

"Invalid section name. The section 'dataConfiguration' does not exist in the requested configuration file 'c:\....web.config' or 'c:\...machine.config'. Make sure that the 'enterpriseLibrary.configurationSections' configuration secion exists in one of the files that the section 'dataConfiguration' is defined.

I understand what the exception means, but I haven't a clue how to fix it. I understand it is expecting to see a dataConfiguration section in either the app's web.config or the server's machine.config. What I don't understand is how to implement a dataConfiguration section in EngLib 3.1. I've searched everywhere for the past 48 hours for advise and have found nothing useful. Could someone please advise how to create configurationSections in EntLib 3.1?

Jun 18, 2007 at 3:48 PM
Is the exception happening because EntLib 1.1 had configurationSections and EntLib 3.1 has configSections?
Jun 19, 2007 at 12:29 PM
Hi Mike

The main changes occurred with EntLib 2.0, when migrating to .NET 2.0. The configuration block was removed and instead the new System.Configuration support from the framework was used, among many other changes, so EntLib versions after 2.0 are not backwards compatible with EntLib 1.1. In the case of the database configuration, EntLib is using the standard .NET connection strings.

You will need to upgrade both the web sites and your shared assembly. You can try having both 1.1 and 3.1 side by side on your apps, as long as you map 1.1 configuration to external files to avoid collisions and the apps don't interact with the shared assembly through EntLib (e.g. by sharing data in a cache), but this would means duplicating configuration and is not guaranteed to work.

Here's a post from David Hayden describing the configuration changes, and I'm sure there are similar posts describing the changes in the blocks.

Jun 19, 2007 at 3:10 PM
Thank you very much for the information!