手机
当前位置:查字典教程网 >编程开发 >asp.net教程 >Web.config(应用程序的配置信息)总结
Web.config(应用程序的配置信息)总结
摘要:Web.config文件是一个XML文本文件,它用来储存ASP.NETWeb应用程序的配置信息(如最常用的设置ASP.NETWeb应用程序的...

Web.config文件是一个XML文本文件,它用来储存 ASP.NET Web 应用程序的配置信息(如最常用的设置ASP.NET Web 应用程序的身份验证方式),它可以出现在应用程序的每一个目录中。当你通过.NET新建一个Web应用程序后,默认情况下会在根目录自动创建一个默认的Web.config文件,包括默认的配置设置,所有的子目录都继承它的配置设置。如果你想修改子目录的配置设置,你可以在该子目录下新建一个Web.config文件。它可以提供除从父目录继承的配置信息以外的配置信息,也可以重写或修改父目录中定义的设置。

在运行时对Web.config文件的修改不需要重启服务就可以生效(注: 节例外)。当然Web.config文件是可以扩展的。你可以自定义新配置参数并编写配置节处理程序以对它们进行处理。

复制代码 代码如下:

<?xml version="1.0"?>

<configuration>

<>

<configSections>

<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">

<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">

<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>

</sectionGroup>

</sectionGroup>

<section name="rewriter" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter"/>

</configSections>

<>

<appSettings>

<add key="ErrPage" value="http://www.cnblogs.com"/>

</appSettings>

<>

<connectionStrings>

<add name="sqlConnectionString" connectionString=""/>

</connectionStrings>

<>

<location path="Default.aspx" allowOverride="false">

<>

<system.web>

<>

<identity impersonate="false" />

<>

<pages masterPageFile="Index" theme="Default" buffer="true" enableViewStateMac="true" validateRequest="false" enableViewState="false">

<>

<controls></controls>

<>

<namespaces></namespaces>

</pages>

<>

<customErrors defaultRedirect="Err.html" mode="RemoteOnly">

<>

<error statusCode="403" redirect="NoAccess.htm" />

<error statusCode="404" redirect="FileNotFound.htm" />

</customErrors>

<>

<trace enabled="true" localOnly="false" pageOutput="true" requestLimit="15" traceMode="SortByCategory"/>

<>

<compilation debug="true" defaultLanguage="c#" batch="false">

<assemblies>

<>

<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

<add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

<add assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

<add assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

<add assembly="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

<add assembly="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

<add assembly="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

<add assembly="System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

<add assembly="System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

</assemblies>

<>

<buildProviders>

<add extension=".aspx" type="System.Web.Compilation.PageBuildProvider"/>

<add extension=".ascx" type="System.Web.Compilation.UserControlBuildProvider"/>

<add extension=".master" type="System.Web.Compilation.MasterPageBuildProvider"/>

<add extension=".asmx" type="System.Web.Compilation.WebServiceBuildProvider"/>

<add extension=".ashx" type="System.Web.Compilation.WebHandlerBuildProvider"/>

<add extension=".soap" type="System.Web.Compilation.WebServiceBuildProvider"/>

<add extension=".resx" type="System.Web.Compilation.ResXBuildProvider"/>

<add extension=".resources" type="System.Web.Compilation.ResourcesBuildProvider"/>

<add extension=".wsdl" type="System.Web.Compilation.WsdlBuildProvider"/>

<add extension=".xsd" type="System.Web.Compilation.XsdBuildProvider"/>

<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>

</buildProviders>

</compilation>

<>

<authentication mode="Forms">

<>

<forms name=".ASPXUSERDEMO" loginUrl="Login.aspx" protection="All" timeout="30"/>

</authentication>

<>

<authorization>

<allow users="*"/>

<deny users="weipeng"/>

<allow users="aa" roles="aa" />

</authorization>

<>

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

<>

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

<>

<sessionPageState historySize="9"/>

<>

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

<>

<httpModules>

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

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

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

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

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

<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.AnonymousIdentificationModule" />

<>

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

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

</httpModules>

<>

<httpHandlers>

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

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

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

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

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

</httpHandlers>

<>

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

<>

<webServices>

<protocols>

<add/>

</protocols>

</webServices>

<>

<caching>

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

<>

<outputCacheSettings>

<outputCacheProfiles>

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

</outputCacheProfiles>

</outputCacheSettings>

</caching>

</system.web>

</location>

<>

<system.net>

<>

<mailSettings>

<smtp from="sy">

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

</smtp>

</mailSettings>

<>

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

<>

<defaultProxy>

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

<bypasslist>

<add address="" />

</bypasslist>

</defaultProxy>

</system.net>

<>

<system.webServer>

<validation validateIntegratedModeConfiguration="false"/>

<modules>

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

</modules>

<handlers>

<remove name="WebServiceHandlerFactory-Integrated"/>

<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

</handlers>

</system.webServer>

<>

<system.web.extensions>

<>

<scripting>

<webServices>

<jsonSerialization maxJsonLength="5000"/>

</webServices>

</scripting>

</system.web.extensions>

<>

<system.serviceModel>

<services>

<service name="WCFStudent.WCFStudentText" behaviorConfiguration="ServiceBehavior">

<>

<endpoint address="" binding="wsHttpBinding" contract="WCFStudent.IStuServiceContract">

<>

<identity>

<dns value="localhost"/>

</identity>

</endpoint>

<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>

</service>

</services>

<behaviors>

<serviceBehaviors>

<behavior name="ServiceBehavior">

<>

<serviceMetadata httpGetEnabled="true"/>

<>

<serviceDebug includeExceptionDetailInFaults="false"/>

</behavior>

</serviceBehaviors>

</behaviors>

</system.serviceModel>

<>

<rewriter>

<rewrite url="~/user/u(.+).aspx" to="~/user/index.aspx?r=$1" />

<rewrite url="~/ask/q(.+).aspx" to="~/home/ask/content.aspx?id=$1" />

<rewrite url="~/blog/b(.+).aspx" to="~/home/blog/article.aspx?r=$1" />

<rewrite url="~/news/n(.+).aspx" to="~/home/news/content.aspx?nid=$1" />

<rewrite url="~/default.aspx" to="~/home/ram/net.aspx" />

</rewriter>

</configuration>

【Web.config(应用程序的配置信息)总结】相关文章:

引用全局程序集缓存内的程序集的方法

ASP.NET动态加载用户控件的实现方法

如何在WebForm中使用javascript防止连打(双击)

asp.net jscript 一句话木马

web.config使用方法指南

ASP.NET存取XML实例代码与注解

几个C#常用正则表达式的总结

“/”应用程序中的服务器错误

ASP.NET Dictionary 的基本用法示例介绍

ASP.NET程序中用Repeater实现分页

精品推荐
分类导航