我有一些非常简单的代码,用于遍历我在Mono上配置文件的各个部分,问题在于:
foreach (ConfigurationSection section in config.Sections)
{
// etc.
}
此代码在dev和其他服务器上运行良好,但在这个新服务器上抛出异常:
System.Configuration.ConfigurationErrorsException: Type 'System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' not found.
我在Ubuntu 14.0.4 LTS服务器上运行Mono。正在运行mono -V
会:
Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-4ubuntu1.1)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen
任何帮助都将不胜感激。
对于记录,异常的完整堆栈跟踪是:
at System.Configuration.InternalConfigurationHost.GetConfigType (System.String typeName, Boolean throwOnError) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigInfo.CreateInstance () [0x00000] in <filename unknown>:0
at System.Configuration.SectionInfo.CreateInstance () [0x00000] in <filename unknown>:0
at System.Configuration.Configuration.GetSectionInstance (System.Configuration.SectionInfo config, Boolean createDefaultInstance) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationSectionCollection.get_Item (System.String name) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationSectionCollection+<GetEnumerator>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0
at Cuscus.API.Settings+<GetValue>c__AnonStorey0.<>m__0 (System.Configuration.Configuration config, System.String settingskey) [0x00000] in <filename unknown>:0
at ...