Enterprise Library Configuration Issues after upgrading project and EntLib Version, could do with some help

Topics: Cryptography Application Block, Exception Handling Application Block
Apr 26, 2007 at 8:30 AM
Hi,

I migrated a VS2003 project to VS2005. The project used the June 2005 Enterprise Library, which I upgraded to the January 2006 version, thinking that that is what would be needed. The site now breaks every time, with the complaint that the configuration section is not defined. However the Web.config has a reference to a configuration section file it and there is a separate config section as well.

Any ideas on what might be happening, as been looking round and can't locate anything.

Mick

The Error Trace:

The configuration section securityCryptographyConfiguration is not defined in the current configuration for the AppDomain.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Configuration.ConfigurationErrorsException: The configuration section securityCryptographyConfiguration is not defined in the current configuration for the AppDomain.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


ConfigurationErrorsException: The configuration section securityCryptographyConfiguration is not defined in the current configuration for the AppDomain.
Microsoft.Practices.EnterpriseLibrary.Security.Cryptography.CryptographyConfigurationView.get_CryptographySettings() +202
Microsoft.Practices.EnterpriseLibrary.Security.Cryptography.CryptographyConfigurationView.GetHashProviderData(String hashProviderName) +130
Microsoft.Practices.EnterpriseLibrary.Security.Cryptography.HashProviderCustomFactory.GetConfiguration(String name, IConfigurationSource configurationSource) +59
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.AssemblerBasedCustomFactory`2.Create(IBuilderContext context, String name, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) +142
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.AssemblerBasedCustomFactory`2.CreateObject(IBuilderContext context, String name, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) +46
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.ConfiguredObjectStrategy.BuildUp(IBuilderContext context, Type t, Object existing, String id) +164
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +93
Microsoft.Practices.ObjectBuilder.SingletonStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +235
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +93
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.ConfigurationNameMappingStrategy.BuildUp(IBuilderContext context, Type t, Object existing, String id) +186
Microsoft.Practices.ObjectBuilder.BuilderBase`1.DoBuildUp(IReadWriteLocator locator, Type typeToBuild, String idToBuild, Object existing, PolicyList[] transientPolicies) +339
Microsoft.Practices.ObjectBuilder.BuilderBase`1.BuildUp(IReadWriteLocator locator, Type typeToBuild, String idToBuild, Object existing, PolicyList[] transientPolicies) +194
Microsoft.Practices.ObjectBuilder.BuilderBase`1.BuildUp(IReadWriteLocator locator, String idToBuild, Object existing, PolicyList[] transientPolicies) +111
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp(IReadWriteLocator locator, String id, IConfigurationSource configurationSource) +338
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp(String id, IConfigurationSource configurationSource) +79
Apr 26, 2007 at 8:45 AM
Probably you reference the old dll versions in the configuration. Does the VS-Configuration dialog work and does it show your complete configuration correctly? If not, my assumption is probably correct and you need to update the PublicKeyToken and Version in the type attribute of the XML-nodes in your config.
Apr 26, 2007 at 9:40 AM
Hi Testalino,

I changed the Version Numbers to 2.0.0.0 everywhere in the config. Many of the public key token had the string Null as value, and in the Crypto one it had a number which matched the public key in the Crypto quick start application config.

However I've been editing these by hand, and not aware of VS-Configuration dialog, is this a tool I need to download?

Cheers, Thanks.

Mickey
Apr 26, 2007 at 12:10 PM
The number 2.0.0.0 is actually not correct. Have a look at the quick start examples to see what is the correct version number for your version. It should be something like 2.9, if you download the latest release the version number is 3.0.0.0

The PublicKeyToken should only be null if you compile the EntLib from source yourself and don't use the precompiled Microsoft versions.

The tool is in the contextmenu of a .config file (e.g. app.config) in the solution explorer of visual studio.

You may be interested in this article: http://blogs.msdn.com/tomholl/archive/2007/04/19/avoiding-configuration-pitfalls-with-incompatible-copies-of-enterprise-library.aspx

You should also read the documentation of the EntLib (which can be found in the VS F1 Help), as it covers alot of your questions.
Apr 26, 2007 at 1:21 PM
Hi, I'm using the January 2006 version of the Library.

Many thanks for the link to blog.
May 15, 2007 at 11:45 AM
The problem was that the method of storing Config data changed between the two versions. In the earlier version it was in separate files referred to by the main config. In the 2.0 version, all the config data is kept in a single file. that is why it was having problems.
May 8, 2008 at 8:24 PM
I am having this same problem. I am upgrading a project from vs2003 to vs2005, which I have done successfully. Now I want to upgrade from Enterprise Library 1.1 to 3.1. I believe I am having problems because of the config files. I have the old app.config as well as a separate config file for each block (ie cachingconfiguration.config, etc.). The app block config files are encrypted. The enterprise library configuration tool won't open the encrypted files, or the enterprise library entires in the app.config for that matter. How do I recreate the config files in 3.1. Also, is there a way to view the contents of the old config files so I can make sure the settings are the same?
May 19, 2008 at 4:33 PM
Hi,

Configuration support was heavily modified in EntLib v2.0 to leverage the configuration features provided by the .NET Framework v2.0; old files, encrypted or not, are not compatible with newer versions. You can try manually converting the files, but it's usually simpler just to replicate the configuration with a newer version of the configuration console.

Fernando


epiazza wrote:
I am having this same problem. I am upgrading a project from vs2003 to vs2005, which I have done successfully. Now I want to upgrade from Enterprise Library 1.1 to 3.1. I believe I am having problems because of the config files. I have the old app.config as well as a separate config file for each block (ie cachingconfiguration.config, etc.). The app block config files are encrypted. The enterprise library configuration tool won't open the encrypted files, or the enterprise library entires in the app.config for that matter. How do I recreate the config files in 3.1. Also, is there a way to view the contents of the old config files so I can make sure the settings are the same?