【发布时间】:2014-07-05 14:49:30
【问题描述】:
我的任务是让这个第三方软件在我们的服务器上运行,但我们只能访问部分代码,其余的仅作为预编译库存在。 其中一个库引发了神秘的异常,我不知道为什么。我完全没有使用 Visual Studio 和 C#,这对我来说毫无意义。
我最初得到的是:
未处理的异常:
未处理的异常:System.TypeInitializationException:类型 “GroupsImporter.Program”的初始化程序引发了异常。 --->
System.Configuration.ConfigurationErrorsException:配置 系统初始化失败--->
System.Configuration.ConfigurationErrorsException:无法识别 配置部分 ThirdPartyCompany.Framework.Core.Configuration.v1.2。 (Y:\path-to-executable\GroupsImporter.exe.Config 第 67 行)
在 System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(布尔值 忽略本地)
在 System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors 架构错误)
在 System.Configuration.ClientConfigurationSystem.EnsureInit(String 配置键)
---内部异常堆栈跟踪结束---
配置文件如下所示:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="AdWordsApi" type="System.Configuration.DictionarySectionHandler"/>
<section name="AdWords.Common.Configuration" type="AdWords.Common.Configuration.AdWordsConfiguration, AdWords.Common"/>
</configSections>
<appSettings>
...
</appSettings>
<AdWords.Common.Configuration Budget ="xxx" CPC="xxx" EstoqueMinimo="x">
...
</AdWords.Common.Configuration>
<AdWordsApi>
...
</AdWordsApi>
<system.web>
...
</system.web>
<system.net>
...
</system.net>
<ThirdPartyCompany.Framework.Core.Configuration.v1.2>
...
</ThirdPartyCompany.Framework.Core.Configuration.v1.2>
</configuration>
反过来,如果我删除它抱怨的部分,我会得到:
未处理的异常:System.TypeInitializationException:类型 “GroupsImporter.Program”的初始化程序引发了异常。 --->
System.Configuration.ConfigurationException:配置部分 ThirdPartyCompany.Framework.Core.Configuration.v1.2 不能 找到了。
在 ThirdPartyCompany.Framework.Core.Guard.Against[TException](Boolean 断言,字符串消息)
在 ThirdPartyCompany.Framework.Core.Configuration.ConfigurationSection.GetConfiguration()
在 ThirdPartyCompany.Framework.Core.IoCContainerWrapper.Implementation.IoCThirdPartyCompanyContainer.loadRegisterConfiguration()
//堆栈继续...
我不知道如何解决这个问题。我无权访问实现 ServiceConfig 类或使用配置的代码。 关于发生了什么以及如何解决此问题的任何想法?
编辑:据说它完全按照提供的方式在公司的服务器上运行。
【问题讨论】:
标签: c# visual-studio-2010 configuration app-config configuration-files