Friday, December 3, 2010

Application configuration files are wonderful and particularly easy to use. In a recent project, however, I added a configuration section and some connectionstrings to an application configuration file. It looked something like this:

(click to enlarge)

Nothing wrong here, the compiler doesn’t complain about anything. So, let’s run it. Then, when creating the workflow runtime, an exception was thrown:

(click to enlarge)

As you can see, the exception message doesn’t say that much (nor the stacktrace or whatsoever). After a little “googling”, I ended up in a blog post that stated a similar problem (configuration system failed to initialize), but the error message was something like “Only one <configSections> element allowed per config file.”. So what, I only have one. Can you guess what’s wrong?

Well, the <configSections> element must be the first child of the root <configuration> element.