c# - Throw a ConfigurationErrorsException when run .net app on ubuntu with mono4 -
i wrote , compiled helloworld app in vs2015rc:
namespace test { class program { protected static readonly namevaluecollection appsettings = configurationmanager.appsettings; private static readonly string rootdir = appsettings["rootdirpath"] ?? ""; static void main(string[] args) { console.writeline("hello world"); console.writeline(rootdir); console.readkey(); } } }
when run app on on ubuntu mono4, configurationerrorsexception
thrown:
lijing@ubuntu:~/desktop/iqq.net$ mono test.exe
unhandled exception: system.typeinitializationexception: exception thrown type initializer test.program system.configuration.configurationerrorsexception: error initializing configuration system. system.configuration.configurationerrorsexception: unrecognized configuration section (/home/lijing/desktop/iqq.net/test.exe.config line 3)
this config file:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <appsettings> <add key="rootdirpath" value="xxxxxxxxxxxxxxxxxxxx"/> <add key="libpath" value="lib\win64\"/> <add key="datadirpath" value=""/> </appsettings> </configuration>
the mono version is: mono jit compiler version 4.0.2 (stable 4.0.2.5/c99aa0c wed jun 24 10:04:37 utc 2015)
Comments
Post a Comment