asp.net 中的 WebConfig配置文件详解

AI权益加码!Claude Code、Cursor等20+工具免费用! 购周边限时加赠Coding Plan Lite,畅享主流AI工具!学习进阶更高效! 阅读详情

<?xml version="1.0"?>
<!--Webconfig的一般执行顺序:
1.当前文件夹
2.父文件夹
3.Framework自定义的两个config文件(web.config和machine.config)
注意:
子目录的配置设置可以提供除从父目录继承的配置信息以外的配置信息,也可以重写或修改父目录中定义的设置。
运行时对Web.config文件的修改不需要重启服务就可以生效(注:<processModel> 节例外);
Web.config文件是可以扩展的。你可以自定义新配置参数并编写配置节处理程序以对它们进行处理;
web.config配置文件(默认的配置设置)以下所有的代码都应该位于<system.web></system.web>之间

-->
<configuration>
 <!--configuration 节根元素,其它节都是在它的内部-->
 <!--配置节处理程序声明 特点:位于配置文件的顶部,包含在<configSections>-->
 <!--自定义Web.config文件配置节过程分为两步。
 1.在配置文件顶部 <configSections> 和 </configSections>标记之间声明配置节的名称和处理该节中配置数据的 .NET Framework 类的名称。
 2.是在 <configSections> 区域之后为声明的节做实际的配置设置。
 -->
 <configSections>
  <section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
  <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
  <section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
  <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
  <section name="ore.SiebelWrite" type="ORE.SiebelWrite.DataAccess.Bases.NetTiersServiceSection, ORE.SiebelWrite.DataAccess" allowDefinition="MachineToApplication" restartOnExternalChanges="true"/>
  <!--配置节组
  特点: 用用<sectionGroup>标记,可以自定义分组,可以放到<configSections>内部或其它<sectionGroup>标记的内部
  -->
  <sectionGroup name="ore">
   <section name="data" type="ORE.Framework.Providers.ProviderConfigurationHandler, ORE.Framework"/>
   <section name="scheduling" type="ORE.Framework.Providers.ProviderConfigurationHandler, ORE.Framework"/>
  </sectionGroup>
  <!--示例:创建一个节存储数据库连接字符串-->
  <section name="appSettings" type="System.Configuration.NameValueFileSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
 </configSections>
 <enterpriseLibrary.ConfigurationSource selectedSource="File Configuration Source">
  <sources>
   <add name="File Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" filePath="entlib.config"/>
  </sources>
 </enterpriseLibrary.ConfigurationSource>
 <loggingConfiguration name="Logging Application Block" tracingEnabled="true" defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
  <listeners>
   <add databaseInstanceName="ORE" writeLogStoredProcName="WriteLog" addCategoryStoredProcName="AddCategory" formatter="Text Formatter" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="Database Trace Listener"/>
  </listeners>
  <formatters>
   <add template="Timestamp: {timestamp}&#xA;Message: {message}&#xA;Category: {category}&#xA;Priority: {priority}&#xA;EventId: {eventid}&#xA;Severity: {severity}&#xA;Title:{title}&#xA;Machine: {machine}&#xA;Application Domain: {appDomain}&#xA;Process Id: {processId}&#xA;Process Name: {processName}&#xA;Win32 Thread Id: {win32ThreadId}&#xA;Thread Name: {threadName}&#xA;Extended Properties: {dictionary({key} - {value}&#xA;)}" type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="Text Formatter"/>
  </formatters>
  <categorySources>
   <add switchValue="All" name="General">
    <listeners>
     <add name="Database Trace Listener"/>
    </listeners>
   </add>
  </categorySources>
  <specialSources>
   <allEvents switchValue="All" name="All Events"/>
   <notProcessed switchValue="All" name="Unprocessed Category"/>
   <errors switchValue="All" name="Logging Errors &amp; Warnings">
    <listeners>
     <add name="Database Trace Listener"/>
    </listeners>
   </errors>
  </specialSources>
 </loggingConfiguration>
 <exceptionHandling>
  <exceptionPolicies>
   <add name="General Policy">
    <exceptionTypes>
     <add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" postHandlingAction="NotifyRethrow" name="Exception">
      <exceptionHandlers>
       <add logCategory="General" eventId="91" severity="Error" title="Enterprise Library Exception Handling" formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" priority="0" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="Logging Handler"/>
      </exceptionHandlers>
     </add>
   &nbs

pb开发web应用 说到pb开发web,一般是将pb发布成webservice,或者转成webform,两者都有很多限制,比如需要iis安装维护麻烦,调试困难,经常遇到莫名的错误,找不到资料,样式调整困难等问题。 随着互联网技术的发展和APP的流行,WEB前端和APP开发,越来越流行。要为前端和APP提供服务需要开发web应用,如果能为熟悉的工具进行开发,可以大大节省开发时间,减少学习成本。SATRDA支持PB插件 阅读详情

相关推荐

Asp.netweb.config配置文件详解

web.config是一个XML文件,用来储存Asp.net Web应用程序的配置信息,包括数据库连接字符、身份安全验证等,可以出现在Asp.net Web应用程序服务器上的任何目录中,每个Web.config将配置设置应用到它所在的目录及虚拟子目录下,子目录中的设置可以随意重写或修改在父目录中指定的设置。该文件不需要重启服务就可以生效。 Asp.net网站IIS启动时会加载配置文件...

weixin_30872499的博客 302

ASP.NET项目站点配置Web.Config文件

ASP.NET配置文件是基于XML的文本文件(每个都命名为Web.Config),可以出现在ASP.NET Web应用程序服务器上的任何目录中。它可以包含标准的XML文档元素(包括格式正确的标记、注释、文本、cdata等)。该文件的编辑格式可以为ANSI、UTF-8或Unicode,系统自动检测编码。 Web.Cconfig文件中包括一些基本的节,下面分别对这些节的配置进行介绍。 ...

352

Asp.net中的web.config配置

Asp.net中的web.config配置 Asp.net中的web.config配置... 1 一、 配置文件保存位置... 2 二、 配置文件加载顺序... 2 三、 配置文件节点介绍... 3 1. <configSections>. 3 2. <appSettings>. 5 3. <connectionStrings>. 5 ...

a410256649的博客 471

asp.Net MVC在webconfig配置文件上传限制。

今天让做一个文件上传限制10MB,怕自己遗忘,做一个备份 在asp.net中,默认情况下,网站能够接收上传的文件大小不能超过4MB,如果用户上传的文件超过这一限制,网站就会自动报错,但如何修改这个限制的大小呢?这里就可以在web.config里面配置MaxRequestLenth元素,它用来指定输入流最大值,就是文件的大小。 配置代码 <httpRuntime maxRequestLenth="10000" executionTimeout="600" /> 之后再文件上传里,做一个文件大小

qq_45548183的博客 707

asp.net中是用伪静态---修改webconfig配置文件

       使用rewrite在iis上设置规则来实现伪静态,这样在vs中开发的时候将无法调试,必须要是用iis发布才不会造成找不到文件的错误,当然,肯定还有其他的方法来实现伪静态的,不用再iis中设置任何的东西,只需要一个。net的组件和设置一下webconfig文件就ok了,来看一下,这东西,我用的次数很少,每次用都怕忘记,所以记录下来,下次忘记的话也不用Google啦      这回的准备工作,你必须去网上download一个URLRewriter.dll组件了,网上貌似有这个类库的源代码,当然里面

侯永奎 2471

Asp.net 2.0 操纵webconfig配置文件

转自http://hi.baidu.com/%B7%E7%D3%EA%B9%CA%C8%CB/blog/item/88326c34b30034395bb5f5d2.htmlAsp.net 2.0 操纵webconfig配置文件2007-07-02 15:45    .net1.1中如果需要灵活的操作和

落日如金,时光如水。 597

asp.net mvc webconfig配置文件操作

读取web.config数据,可以不用编译。如发布后,非常有用web.config文件<configuration> <appSettings> <add key="Pwd" value="yms6666" /> </appSettings> </configuration> c#后台代...

dibeichan3033的博客 380

WebConfig配置文件详解

今天看到博客园一位朋友整理的一个WebConfig配置文件详解,觉得不错,转载一下: xml version="1.0"?> 注意: 除了手动编辑此文件以外,您还可以使用 Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的“网站”->“Asp.Net 配置”选项。 设置和注释的完整列表在 machine.config.comments 中,该文件通常位于

生命不息,奋斗不止 1490

配置文件入门 - WebConfig.config常用配置节点介绍

配置文件入门 - WebConfig.config常用配置节点介绍   一、配置文件入门   .Net提供了一种保存项目配置信息的办法,就是利用配置文件配置文件的后缀一般是.config。在WinForm程序中配置文件一般是App.config。在Asp.net...

ajwqb06628的专栏 320

C# asp.net we应用程序(.net framework)Webconfig配置文件

自己写了一个网页,里面的webconfig文件还是没配好,每次在iis里启动的时候就是第一张图一样,点开目录才能进去,并不是直接就到首页的,怎么省去图一这个环节呀。

2201_76081160的博客 287

asp.net2.0WebConfig配置文件中设置数据库链接

  

meloveself的专栏 588
上一篇: Dom中常用的方法
下一篇: asp.Net性能优化
bigstoneasd
博客等级 码龄23年 16粉丝 81原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值