Configuration exception when migrating a ASP.NET application to a Azure webrole

by Damiaan Peeters 31. March 2011 01:50

Ok.  I found why I got a configuration exception every time I launched my azure project (in visual studio 2010). 

I have installed Azure Tools 1.4, on my Visual Studio 2010 SP1.

The problem

When I launched the appFabric / Azure Compute Emulator, I got a my visual studio telling my that I he didn’t have any trace or disassembly information. 

The most annoying part of this situation is that my WebRole Entry point wasn’t started neither.

This was the error (cut some path’s out to keep it readable).

System.Configuration.ConfigurationErrorsException was unhandled
  Message=Configuration system failed to initialize
  BareMessage=Configuration system failed to initialize
       at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
       at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(String sectionName)
       at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
       at System.Configuration.ConfigurationManager.GetSection(String sectionName)
       at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
       at System.Diagnostics.DiagnosticsConfiguration.GetConfigSection()
       at System.Diagnostics.DiagnosticsConfiguration.Initialize()
       at System.Diagnostics.DiagnosticsConfiguration.get_IndentSize()
       at System.Diagnostics.TraceInternal.InitializeSettings()
       at System.Diagnostics.TraceInternal.get_Listeners()
       at System.Diagnostics.Trace.get_Listeners()
       at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.Initialize(String[] args)
       at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.Initialize(String[] args)
       at Microsoft.WindowsAzure.Hosts.WaIISHost.Program.RunEntryPoint(Parameters parameters)
       at Microsoft.WindowsAzure.Hosts.WaIISHost.Program.Main(String[] args)
  InnerException: System.Configuration.ConfigurationErrorsException
       Message=Configuration file [CUT].WL.dll.config does not have root <configuration> tag (C:\Users\[CUT]\approot\bin\[CUT].WL.dll.config line 2)
       BareMessage=Configuration file [CUT].WL.dll.config does not have root <configuration> tag
            at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
            at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
            at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
            at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)


So what does it mean.  If you open up the config file mentioned in the (inner) exception. You might notice this is not a complete configuration file.  For me it was my App.Settings file. 

What I did?  I moved my app.Settings into my Web.config file.  And gone was the error.

I think this is a bug. So, I posted it to Microsoft Connect so you can review it overthere:

Dynamic themes in ASP.NET 2.0 (C#)

by Damiaan Peeters 22. March 2008 12:11

Today I looked at the ASP.NET 2.0 Themes.  I've been using them for a long time, but I never knew that you can set a default theme in the web.config.

Just add this to the system.web section

<pages styleSheetTheme="Black"/>

Further more I needed to change my theme dynamically.  I found an interesting article on this topic on CodeProject.

CodeProject: Dynamic themes in ASP.NET 2.0 (C#).

Certified Umbraco Master, Part of Umbraco Certified partner comm-it, .Net and Azure developer, seo lover. Magician in my spare time.

Month List