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
  Source=System.Configuration
  BareMessage=Configuration system failed to initialize
  Line=0
  StackTrace:
       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)
       Source=System.Configuration
       BareMessage=Configuration file [CUT].WL.dll.config does not have root <configuration> tag
       Filename=C:\Users\damiaan.COMM-IT\[CUT]\approot\bin\[CUT].WL.dll.config
       Line=2
       StackTrace:
            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)
       InnerException:

Solution

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:

https://connect.microsoft.com/VisualStudio/feedback/details/654955/system-configuration-configurationerrorsexception-when-starting-website-hosted-by-azure-appfabric-compute-emulator#tabs

blog comments powered by Disqus

Who.I.am

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

Month List