我一直面临一个不寻常的问题,在我的单元测试项目中我遇到了这个错误,而且奇怪的是一些通常通过的测试,在下一次运行中失败。有了这个错误,我也得到了 AutoMapperMappingExceptions,尽管我正在尝试从程序集中加载所有配置文件。我也检查了我的 app.config 是否存在潜在错误。我正在运行 xunit2,automapper 3.2.1。我正在附加堆栈跟踪的一部分
System.Configuration.ConfigurationErrorsException
Configuration system failed to initialize
at System.Configuration.ConfigurationManager.PrepareConfigSystem()
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Web.Configuration.ClientRuntimeConfig.GetSectionObject(String sectionName)
at System.Web.Configuration.RuntimeConfig.GetSection(String sectionName, Type type, ResultsIndex index)
at System.Web.Configuration.RuntimeConfig.get_HttpRuntime()
at System.Web.Util.HttpEncoder.GetCustomEncoderFromConfig()
at System.Lazy`1.CreateValue()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Lazy`1.get_Value()
at System.Web.Util.HttpEncoder.get_Current()
at System.Web.HttpUtility.HtmlDecode(String s)