Web.config配置文件详解2

来源:互联网 发布:黑天工作室出的网络剧 编辑:程序博客网 时间:2024/05/06 11:06

 <!--站点全球化设置,requestEncoding: 它用来检查每一个发来请求的编码.responseEncoding: 用于检查发回
的响应内容编码.fileEncoding:用于检查aspx,asax等文件解析的默认编码,默认的编码是utf-8
-->


   
<globalization requestEncoding="gb2312" responseEncoding="gb2312" fileEncoding="gb2312" />

   
<!--会话状态设置。mode: 分为off,Inproc,StateServer,SqlServer几种状态 mode = InProc 存储在进程中
特点:具有最佳的性能,速度最快,但不能跨多台服务器存储共享.mode = "StateServer" 存储在状态服务器中特点:当
需要跨服务器维护用户会话信息时,使用此方法。但是信息存储在状态服务器上,一旦状态服务器出现故障,信息将丢失.
mode="SqlServer" 存储在sql server中特点:工作负载会变大,但信息不会丢失

    stateConnectionString :指定asp.net应用程序存储远程会话状态的服务器名,默认为本机。sqlConnectionStri
ng:当用会话状态数据库时,在这里设置连接字符串。Cookieless:设置为flase时,表示使用cookie会话状态来标识客户
.timeout表示会话超时时间。
-->


   
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionS
tring
="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="20"></
ses
sionState
>


   
<!--为 ASP.NET 应用程序配置页的视图状态设置。设置要存储在页历史记录中的项数。-->

   
<sessionPageState historySize="9"/>  

   
<!--
配置asp.net http运行库的设置。可以在计算机,站点,应用程序和子目录级别声明

    允许最多的请求个数100,最长允许执行请求时间为80秒,控制用户上传文件的大小,默认是4M。useFullyQualifie
dRedirectUrl客户端重定向不需要被自动转换为完全限定格式。
-->


   
<httpRuntime appRequestQueueLimit="100" executionTimeout="80" maxRequestLength="4
0960"
useFullyQualifiedRedirectUrl="false"/>


   
<!--httpModules在一个应用程序内配置 HTTP 模块。-->

   
<httpModules>

     
<add name="OutputCache" type="System.Web.Caching.OutputCacheModule" />

     
<add name="Session" type="System.Web.SessionState.SessionStateModule" />

     
<add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationM
odule"
/>


     
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />

     
<add name="PassportAuthentication" type="System.Web.Security.PassportAuthenticationMo
dule"
/>


     
<add name="RoleManager" type="System.Web.Security.RoleManagerModule" />

     
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />

     
<add name="FileAuthorization" type="System.Web.Security.FileAuthorizationModule" />

     
<add name="AnonymousIdentification" type="System.Web.Security.AnonymousIdentificatio
nModule"
/>


     
<!--自定义的URL重写,type基本上就是dll名-->

     
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.U
rlRewriter"
/>


     
<add name="Profile" type="System.Web.Profile.ProfileModule" />

   
</httpModules>

   
<!--
httpHandlers用于根据用户请求的URL和HTTP谓词将用户的请求交给相应的处理程序。可以在配置级别的任何
层次配置此节点,也就是说可以针对某个特定目录下指定的特殊文件进行特殊处理。

    add:指定映射到处理程序的谓词/路径。clear:移除当前已配置或已继承的所有处理程序映射。remove:移除映射到
处理程序的谓词/路径。remove 指令必须与前一个 add 指令的谓词/路径组合完全匹配。该指令不支持通配符。
-->


   
<httpHandlers>

     
<remove verb="*" path="*.asmx"/>

     
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandl
erFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3
856ad364e35"
/>


     
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.
ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKey
Token=31bf3856ad364e35"
/>


     
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResou
rceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31
bf3856ad364e35"
validate="false"/>


     
<add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro.2"/>

   
</httpHandlers>

   
<!--为 Web 应用程序使用的 Cookie 配置属性。domain:设置 Cookie 域名。httpOnlyCookies:在 Interne
t Explorer 6 SP1 中启用 HttpOnlyCookies Cookie 的输出。默认值为 false。requireSSL:获取一个指示是否需
要安全套接字层 (SSL) 通信的值.
-->


   
<httpCookies httpOnlyCookies="false" requireSSL="false"/>

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


   
<webServices>

     
<protocols>

       
<add/>

     
</protocols>

   
</webServices>

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


   
<caching>

     
<cache disableMemoryCollection = "false" disableExpiration = "false" privateBytesLimit = "0"
percentagePhysicalMemoryUsedLimit
= "90" privateBytesPollTime = "00:02:00"/>

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


     
<outputCacheSettings>

       
<outputCacheProfiles>

         
<add name="ServerOnly" duration="60" varyByCustom="browser" location="Server" />

       
</outputCacheProfiles>

     
</outputCacheSettings>

   
</caching>

    
</system.web>

</location>

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

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


<system.net>

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

<mailSettings>

  
<smtp from="weipeng">

   
<network host="Gao" password="" userName="" />

  
</smtp>

</mailSettings>

  

原创粉丝点击