简体   繁体   中英

Program fails to start; Event Viewer logs ConfigurationsErrorException

Issue: On my development machine, everything works fine. However, when I copy the executable to the server, my program doesn't start

What I've done so far: I checked the event viewer and the error stack looks like this:

 Application: Project.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.Configuration.ConfigurationErrorsException Stack: at System.Configuration.ClientConfigurationSystem.EnsureInit(System.String) at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(System.String) at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(System.String) at System.Configuration.ConfigurationManager.GetSection(System.String) at System.Configuration.ConfigurationManager.get_ConnectionStrings() at Project.BaseService..ctor() at Project.Service..ctor() at Project.Program.Main() 

I checked online and, most of the times, this error is generated by some misplacement of configSections on the .config files. To make sure this was not the case, I let both app.config and .exe.config files clean (only the section was there), but my program still didn't work.

Then, I generated a dump file from the failing process and here is where things get strange: the exception that is thrown when I'm calling ConfigurationManager.ConnectionStrings is "Configuration System failed to initialize", with a "The 'add' start tag on line 257 position 6 does not match the end tag of 'connectionManagement'. Line 258, position 3." inner exception. I double-checked my entire project and there is not a single reference to "connectionManagement" anywhere! I even tried to check AppDomain.CurrentDomain.SetupInformation.ConfigurationFile's value and it indicates the right config file.

By fixing this connectionManagement issue I'll probably be able to run my application, but do you guys have any idea about where this might be coming from?

Problem was on the machine.config file on the server. Changing it solved the problem!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM