简体   繁体   English

C#app.config问题 - ConfigurationErrorsException:无法识别的元素'setting'

[英]C# app.config problem - ConfigurationErrorsException: Unrecognized element 'setting'

Some background: I have a windows service with 5 web references, Everything works great in several environments Dev,Test,QC. 一些背景:我有一个带有5个Web引用的Windows服务,Everything在几个环境Dev,Test,QC中运行良好。 Dev and Test are running windows 2003, QC and PROD windows 2000. We pushed the service to production with the same set of assemblies and config files and are receiving this error. 开发和测试正在运行Windows 2003,QC和PROD Windows 2000.我们使用相同的程序集和配置文件将服务推送到生产并且收到此错误。 The exception is not consistent through the same block of code. 异常在同一代码块中不一致。 Other web reference are working that use the same standard configuration elements. 其他Web引用正在使用相同的标准配置元素。

The exception : 例外

 System.Xml.XmlDocumentSystem.Configuration.
ConfigurationErrorsException: Unrecognized  
element 'setting'

Example config sections: 示例配置部分:

<sectionGroup name="applicationSettings"
 type="System.Configuration.ApplicationSettingsGroup, 
 System, Version=2.0.0.0,
 Culture=neutral, PublicKeyToken=b77a5c561934e089" >
      <section name="Blah.AWD.SubSystem.AUE.Properties.Settings"
      type="System.Configuration.ClientSettingsSection, 
      System, Version=2.0.0.0,
       Culture=neutral, PublicKeyToken=b77a5c561934e089" 
      requirePermission="false" />
</sectionGroup>


<applicationSettings>
 <Blah.AWD.SubSystem.AUE.Properties.Settings>
  <setting name=
   "AWD_SubSystem_AUE_WebService_Validator_AppEntryValidator"
    serializeAs="String">
        <value>http://blah.asmx</value>
  </setting> 
 </Blah.AWD.SubSystem.AUE.Properties.Settings>      
</applicationSettings>

I will accept John's answer as being correct because it ended up being a deployment issue and was specific to the environment. 我会接受John的答案是正确的,因为它最终成为部署问题并且特定于环境。 Nothing was actually wrong with the config. 配置没有任何问题。

The exception: 例外:

 System.Xml.XmlDocumentSystem.Configuration.
ConfigurationErrorsException

is caused if you put an element in your config that is not recognized and not able to be serialized from the custom configuration class. 如果您在配置中放置了一个无法识别且无法从自定义配置类序列化的元素,则会导致此问题。

Are you 100% sure that the production environment is on the same version of .NET as your others? 您是否100%确定生产环境与其他版本的.NET在同一版本上? If the exact same code (you're sure all assemblies were dropped correctly?) runs correctly in 5 environments, and pukes in production, it sounds like it may be an environmental issue. 如果完全相同的代码(你确定所有的程序集都被正确删除?)在5个环境中正确运行,并且在生产中呕吐,听起来这可能是一个环境问题。

Is it possible that -- gah -- your prod environment only has .NET 1.1 available? 是否有可能 - 你的prod环境只有.NET 1.1可用吗? Or that the web service in question was dropped into a 1.1 AppPool on IIS? 或者有问题的Web服务被放入IIS上的1.​​1 AppPool中? (Although it sounds like the issue isn't the web service, but the Windows service -- which should moot out the last question ... ) (虽然听起来问题不是网络服务,而是Windows服务 - 这应该是最后一个问题......)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 读取app.config设置时出现ConfigurationErrorsException - ConfigurationErrorsException when reading app.config setting 在新环境中从C#WinForms应用程序读取加密的app.config时,ConfigurationErrorsException - ConfigurationErrorsException when reading encrypted app.config from C# WinForms application in new environment C#更新app.config元素 - C# update app.config element C#WCF System.Configuration.ConfigurationErrorsException:无法识别的元素&#39;ManagedService&#39; - C# WCF System.Configuration.ConfigurationErrorsException: Unrecognized element 'ManagedService' System.Configuration.ConfigurationErrorsException-无法识别的元素“设置” - System.Configuration.ConfigurationErrorsException - Unrecognized element 'setting' C#Web参考-在app.config中设置超时 - C# web reference -setting the Timeout in app.config 从C#App.config文件获取设置 - Get setting from C# App.config file C#基于comboBox选择检索app.config设置 - C# retrieve app.config setting base on comboBox selection C#控制台库app.config连接字符串问题 - C# Console Library app.config connection string problem App.Config PostgreSQL实体框架6的Npgsql C#问题 - Npgsql C# problem with App.Config PostgreSQL Entity Framework 6
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM