Web.config配置文件详解(4)

本文详细介绍了ASP.NET中关键配置项的设置方法,包括Web服务协议配置、缓存管理、网络设置及AJAX支持等。通过具体示例展示了如何优化应用程序性能。

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

 <!--控制 ASP.NET Web 服务及其客户端的行为。protocols:指定传输协议,ASP.NET 可使用这些传输协议来解密 HTTP-->

    <webServices>

      <protocols>

        <add/>

      </protocols>

    </webServices>

    <!--为 Web 应用程序配置缓存设置。cache:定义全局应用程序缓存设置。outputCache :指定应用程序范围的输出缓存设置。outputCacheSettings:指定可以应用于应用程序中页的输出缓存设置。sqlCacheDependency:为 ASP.NET 应用程序配置 SQL 缓存依赖项。-->

    <caching>

      <cache disableMemoryCollection = "falsedisableExpiration = "falseprivateBytesLimit = "0percentagePhysicalMemoryUsedLimit = "90privateBytesPollTime = "00:02:00"/>

      <!--设计需要以这种方式缓存的页时,您需要向该页添加以下指令:<%@ OutputCache CacheProfile="ServerOnly" %>-->

      <outputCacheSettings>

        <outputCacheProfiles>

          <add name="ServerOnlyduration="60varyByCustom="browserlocation="Server" />

        </outputCacheProfiles>

      </outputCacheSettings>

    </caching>

     </system.web>

 

 </location>

 <!--网络设置,authenticationModules:指定用于对 Internet 请求进行身份验证的模块。connectionManagement:指定与 Internet 宿主的连接的最大数目。defaultProxy:配置超文本传输协议 (HTTP) 代理服务器。

 mailSettings:配置简单邮件传输协议 (SMTP) 邮件发送选项。requestCaching:控制网络请求的缓存机制。settings:配置 System.Net 的基本网络选项。-->

 <system.net>

 <!--配置SMTP电子邮件设置-->

 <mailSettings>

   <smtp from="weipeng">

    <network host="Gaopassword="" userName="" />

   </smtp>

 </mailSettings>

   <!--禁用所有缓存-->

   <requestCaching disableAllCaching="true"></requestCaching>

   <!--指定代理地址,并对本地访问和 contoso.com 跳过代理。-->

   <defaultProxy>

     <proxy usesystemdefault="Trueproxyaddress="http://192.168.1.10:3128bypassonlocal="True"/>

     <bypasslist>

       <add address="[a-z]+".contoso".com" />

     </bypasslist>

   </defaultProxy>

 </system.net>

 <!--该节替换在 httpHandlers 和 httpModules 节中添加的与 AJAX 相关的 HTTP 处理程序和模块。该节使 IIS 7.0 在集成模式下运行时可使用这些处理程序和模块。在iis7.0 下运行 ASP.NET AJAX 需要 system.webServer

 节。对早期版本的 IIS 来说则不需要此节。 -->

 <system.webServer>

    <validation validateIntegratedModeConfiguration="false"/>

    <modules>

      <add name="ScriptModulepreCondition="integratedModetype="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    </modules>

    <handlers>

      <remove name="WebServiceHandlerFactory-Integrated"/>

      <add name="ScriptHandlerFactoryverb="*path="*.asmxpreCondition="integratedModetype="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

      <add name="ScriptHandlerFactoryAppServicesverb="*path="*_AppService.axdpreCondition="integratedModetype="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

      <add name="ScriptResourcepreCondition="integratedModeverb="GET,HEADpath="ScriptResource.axdtype="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    </handlers>

 </system.webServer>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值