ConfigurationSetting.GetConfig()我不明白 [英] ConfigurationSetting.GetConfig() I don't get it

查看:86
本文介绍了ConfigurationSetting.GetConfig()我不明白的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据文档ConfigurationSetting.GetConfig(string)

用于获取用户定义的配置设置。然而,无论我如何尝试将我自己的部分添加到app.config中我一直收到错误,说明找到了无效的

配置文件部分。所以,有人可以告诉我这是怎么回事

使用??

谢谢


JIM

解决方案

" james" <无**** @ hypercon.net> schrieb

根据文档ConfigurationSetting.GetConfig(string)用于获取用户定义的配置设置。然而,无论我如何尝试将自己的部分添加到app.config,我都会收到错误,指出找到了无效的配置文件部分。所以,有人能否告诉我如何使用它?




嗨詹姆斯,

你可以发贴你的app.config,这样我们就可以更轻松地帮助你了。


干杯


Arne Janning


<?xml version =" 1.0" ?>

< configuration>

< appSettings>

< add key =" Application Name"值= QUOT; XXXX" />

< add key =" Version"值= QUOT; 3.0" />

< add key ="作者"值= QUOT; YYYYY" />

< add key ="版权所有" value =" Copyright(c)xxxx" />

< / appSettings>

< / configuration>

所以我尝试添加


< TEST>

< add key =" BLAH"值= QUOT; BLAH" />

< / TEST>


我尝试在每个可能的位置添加它但我只是得到错误

JIM

" Arne Janning" < SP ***************** @ msn.com>在消息中写道

news:%2 **************** @ TK2MSFTNGP10.phx.gbl ...

"詹姆斯" <无**** @ hypercon.net> schrieb

根据文档ConfigurationSetting.GetConfig(string)
用于获取用户定义的配置设置。然而,无论我如何尝试
将我自己的部分添加到app.config我一直收到错误,说明发现
无效的配置文件部分。所以,有人可以让我知道这个
是如何使用的吗?



詹姆斯,

你能不能请发布你的app.config,以便我们更容易帮助你。

干杯

Arne Janning


尝试这样添加:


< configuration>


< configSections>

< section name =" test" type =" System.Configuration.DictionarySectionHandle r"

/>

< / configSections>


< appSettings> ;

< add key ="应用程序名称"值= QUOT; XXXX" />

< add key =" Version"值= QUOT; 3.0" />

< add key ="作者"值= QUOT; YYYYY" />

< add key ="版权所有" value =" Copyright(c)xxxx" />

< / appSettings>


< test>

< add key =" BLAH"值= QUOT; BLAH" />

< / test>


< / configuration>

HTH;

Eric Cadwell
http://www.origincontrols.com

According to the documentation ConfigurationSetting.GetConfig( string ) is
used to get user defined config settings. Yet, no matter how I try to add
my own sections to the app.config I keep getting errors stating an invalid
config file section found. So, can someone elighten me as to how this is to
be used ??
thanks

JIM

解决方案

"james" <no****@hypercon.net> schrieb

According to the documentation ConfigurationSetting.GetConfig( string ) is
used to get user defined config settings. Yet, no matter how I try to add
my own sections to the app.config I keep getting errors stating an invalid
config file section found. So, can someone elighten me as to how this is
to
be used ??



Hi James,

could you please post your app.config so that it is easier for us to help
you.

Cheers

Arne Janning


<?xml version="1.0" ?>
<configuration>
<appSettings>
<add key="Application Name" value="xxxx" />
<add key="Version" value="v3.0" />
<add key="Author" value="yyyyy" />
<add key="Copyright" value="Copyright(c) xxxx" />
</appSettings>
</configuration>
so I tried adding

<TEST>
<add key="BLAH" value="BLAH" />
</TEST>

and I tried adding it in every possible location but I just get the error

JIM
"Arne Janning" <sp*****************@msn.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...

"james" <no****@hypercon.net> schrieb

According to the documentation ConfigurationSetting.GetConfig( string ) is used to get user defined config settings. Yet, no matter how I try to add my own sections to the app.config I keep getting errors stating an invalid config file section found. So, can someone elighten me as to how this is to
be used ??



Hi James,

could you please post your app.config so that it is easier for us to help
you.

Cheers

Arne Janning



Try adding it like this:

<configuration>

<configSections>
<section name="test" type="System.Configuration.DictionarySectionHandle r"
/>
</configSections>

<appSettings>
<add key="Application Name" value="xxxx" />
<add key="Version" value="v3.0" />
<add key="Author" value="yyyyy" />
<add key="Copyright" value="Copyright(c) xxxx" />
</appSettings>

<test>
<add key="BLAH" value="BLAH" />
</test>

</configuration>
HTH;
Eric Cadwell
http://www.origincontrols.com


这篇关于ConfigurationSetting.GetConfig()我不明白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆