configSections 的 section 元素

本文介绍如何使用type属性来指定配置节处理程序类,用于处理配置文件中的特定配置节。通过完全限定类名和程序集详细信息来定义处理程序,确保程序集与Web.config文件位于同一目录。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

type

--------------
必选的 String 属性。

指定用来执行如下操作的配置节处理程序类的名称:处理在 name 属性中指定的节或元素中的配置设置。使用以下格式:

type="完全限定类名, 程序集文件名, 版本, 区域性, 公钥标记"

定义必须匹配程序集引用。例如,如果下面的示例语法中的版本号与程序集不匹配,则会发生错误。

复制代码
type="MyConfigSectionHandler.MyHandler,MyCustomConfigurationHandler,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null"

程序集文件必须与定义它的 Web.config 文件位于同一个应用程序目录中。对于根 Web.config 文件或 Machine.config 文件,程序集文件必须位于 %SystemRoot%\Microsoft.NET\Framework\版本目录中。

----------------------------
示例

<configuration>

   <configSections>
      <section name="sampleSection"
               type="System.Configuration.SingleTagSectionHandler" />
   </configSections>

   <sampleSection setting1="Value1" 
                  setting2="value two" 
                  setting3="third value" />

</configuration>

 

转载于:https://www.cnblogs.com/jes_shaw/archive/2009/07/19/1526747.html

<?xml version=“1.0” encoding=“utf-8”?> <configuration> <configSections> <section name=“connectionSettings” type=“System.Configuration.AppSettingsSection” /> <section name=“communicationSettings” type=“System.Configuration.AppSettingsSection” /> <section name=“packageSettings” type=“System.Configuration.AppSettingsSection” /> <section name=“sessionSettings” type=“System.Configuration.AppSettingsSection” /> <section name=“analyticsSettings” type=“System.Configuration.AppSettingsSection” /> <section name=“webProxySettings” type=“System.Configuration.AppSettingsSection” /> <section name=“robotCacheSettings” type=“System.Configuration.AppSettingsSection” /> <section name=“robotJsSettings” type=“System.Configuration.AppSettingsSection” /> </configSections> <connectionSettings> <add key=“defaultServiceUrl” value=“https://cloud.uipath.com” /> </connectionSettings> <communicationSettings> <add key=“maxMessageSizeInMegabytes” value=“1” /> <add key=“installPackageTimeout” value=“00:20:00” /> <add key=“requestTimeout” value=“00:00:40” /> </communicationSettings> <packageSettings> <add key=“disableSecureXaml” value=“False” /> </packageSettings> <sessionSettings /> <analyticsSettings> <add key=“Telemetry.Enabled” value=“True” /> </analyticsSettings> <webProxySettings /> <robotCacheSettings /> <robotJsSettings /> </configuration>C#如何读取这个配置文件里的内容
03-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值