Summary of configuration information for the Web.config of application

  • 2020-05-19 04:45:07
  • OfStack

The Web.config file is an XML text file used to store configuration information for the ASP.NET Web application (such as the most commonly used Settings for the authentication of the ASP.NET Web application), which can appear in each directory of the application. When you create a new Web application via.NET, a default Web.config file is automatically created in the root directory by default, including the default configuration Settings, which all subdirectories inherit. If you want to change the configuration Settings of the subdirectory, you can create a new Web.config file in the subdirectory. It can provide configuration information in addition to configuration information inherited from the parent directory, or it can override or modify Settings defined in the parent directory.

Changes to the Web.config file take effect at run time without restarting the service (note: section exception). Of course the Web.config file is extensible. You can customize new configuration parameters and write configuration section handlers to handle them.
 
<?xml version="1.0"?> 
<configuration> 
<!-- Specifies the configuration section and namespace declaration. clear: Removes all references to inherited sections and section groups, only allowed by current  section  and  sectionGroup  The element adds sections and section groups. remove: Removes references to inherited sections and section groups. section: Defines the association between the configuration section handler and the configuration element. sectionGroup: Defines the association between the configuration section handler and the configuration section. --> 
<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 Is the application Settings, you can define the application's global constant Settings and other information. --> 
<appSettings> 
<add key="ErrPage" value="http://www.cnblogs.com"/> 
</appSettings> 
<!-- Connection string Settings --> 
<connectionStrings> 
<add name="sqlConnectionString" connectionString=""/> 
</connectionStrings> 
<!-- Specify the resources to apply subconfiguration Settings and lock the configuration Settings to prevent them from being overwritten by the quilt configuration file. path Specifies the resources to apply the included configuration Settings. allowOverride Whether to allow the rewrite of the configuration file to improve the security of the configuration file. --> 
<location path="Default.aspx" allowOverride="false"> 
<!-- control asp.net Runtime behavior --> 
<system.web> 
<!--identity control web The authentication identity of the application .--> 
<identity impersonate="false" /> 
<!-- Identifies page-specific configuration Settings (such as whether to enable session state, view state, whether to detect user input, and so on). <pages> Can be declared at the computer, site, application, and subdirectory levels.  
masterPageFile : the default home page is Index .  
theme : the theme is Default .  
buffer : specify  URL  Whether the resource is using response buffering. The default value is  True .  
enableViewStateMac : when specifying the page to be sent back from the client, ASP.NET  Whether the message authentication code should be run against the view state of the page  (MAC) . If it is  True , the encrypted view state is checked to verify that the view state has been tampered with on the client side. The default value is  True .  
validateRequest Instructions:  ASP.NET  Check everything you enter from the browser for potentially dangerous data. If it is  True , by combining all the input data with 1 A list of potentially dangerous values is compared to perform request validation. If a match occurs, ASP.NET  Will lead to  HttpRequestValidationException  The exception. The default value is  True .  
enableViewState : specifies whether view state is enabled and held between multiple page requests. The default value is  True . --> 
<pages masterPageFile="Index" theme="Default" buffer="true" enableViewStateMac="true" validateRequest="false" enableViewState="false"> 
<!--controls  The element defines where the tag prefix resides  register  A collection of instructions and namespaces --> 
<controls></controls> 
<!-- A collection of import instructions that will be used during assembly precompilation --> 
<namespaces></namespaces> 
</pages> 
<!-- Default error page Settings.  
mode : On . Off . RemoteOnly 3 Kind of state. On Indicates that custom information is always displayed;  Off Indicates that details are always displayed asp.net Error message;  RemoteOnly Means not local only Web Users running on the server display custom information.  
defaultRedirect : used to redirect in the event of an error URL Address. --> 
<customErrors defaultRedirect="Err.html" mode="RemoteOnly"> 
<!-- Special code number error from directional file --> 
<error statusCode="403" redirect="NoAccess.htm" /> 
<error statusCode="404" redirect="FileNotFound.htm" /> 
</customErrors> 
<!-- Configure debugging and tracing.  
enabled : whether to enable tracing for the application. The default value is  false .  
localOnly : specifies the trace viewer  (Trace.axd)  Whether only for the host  Web  The server. If it is  false , the trace viewer can be used on any computer. By default, Trace.axd  The viewer is added to  httpHandlers  Elements. The default value is  true .  
pageOutput : specified in each 1 Whether the trace output is rendered at the end of the page. If it is  false , the trace output can only be accessed through the trace utility. The default value is  false .  
requestLimit : specifies the number of trace requests to be stored on the server. If the limit is reached, and  mostRecent  Features for  false , will automatically disable the trace. The maximum request limit is  10,000 . If you specify greater than  10,000  The value of the ASP.NET  It rounds it down without giving any hint  10,000 . The default value is  10 .  
traceMode : specifies the order in which trace information is displayed. traceMode  Properties can be of the following possible values 1 .  
 value   instructions  
SortByCategory  Specifies that trace information is displayed alphabetically according to user-defined categories.  SortByTime  Specifies that trace information is displayed in the order in which trace information is processed.  
 The default value is  SortByTime . --> 
<trace enabled="true" localOnly="false" pageOutput="true" requestLimit="15" traceMode="SortByCategory"/> 
<!--  Set up the  compilation debug="true"  Inserts the debug symbol into the compiled page. However, because this affects performance, this value is only set to  true . Set the default development language C# . batch Whether batch processing is supported --> 
<compilation debug="true" defaultLanguage="c#" batch="false"> 
<assemblies> 
<!-- Add assembly references for each addition 1 Two assemblies, which means your application has become dependent 1 An assembly that you can use in your application --> 
<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> 
<!-- Defines a collection of build providers for compiling custom resource files. --> 
<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> 
<!-- through  <authentication>  Section can be configured  ASP.NET  The use of   Secure authentication mode to identify the incoming user. Windows:  use IIS Verification mode. Forms:  Use form-based validation. Passport:  using Passport cookie Validate the schema. None:  No validation is used. --> 
<authentication mode="Forms"> 
<!--Name:  Specifies that authentication is completed Http cookie The name of the.  
LoginUrl:  If the page does not pass validation or is redirected after a timeout URL . 1 Generally for the login page, let the user login again.  
Protection:  The specified  cookie How data is protected. Can be set to :All Represents two ways to encrypt data and conduct validity verification, None Means no protection Cookie . Encryption Said to Cookie The content is encrypted, validation Said to Cookie Content validation.  
TimeOut:  The specified Cookie Failure time. Login again after the timeout. --> 
<forms name=".ASPXUSERDEMO" loginUrl="Login.aspx" protection="All" timeout="30"/> 
</authentication> 
<!-- Control of  URL  Client access to resources, such as allowing anonymous users to access them. This element can be declared at any level (computer, site, application, subdirectory, or page). Necessary and <authentication>  Section used together. This means that anonymous users are not authenticated. Refused to user weipeng--> 
<authorization> 
<allow users="*"/> 
<deny users="weipeng"/> 
<allow users="aa" roles="aa" /> 
</authorization> 
<!-- Site globalization Settings ,requestEncoding:  It checks everything 1 The code that sent the request. responseEncoding:  Used to check the response content encoding sent back .fileEncoding: Used to check aspx,asax Such as the default encoding for file parsing , The default encoding is utf-8--> 
<globalization requestEncoding="gb2312" responseEncoding="gb2312" fileEncoding="gb2312" /> 
<!-- Session state Settings.  
mode:  Divided into off,Inproc,StateServer,SqlServer Several states. mode ="InProc"  Stored in the process, features: best performance, fastest , It cannot be Shared across multiple servers. mode = "StateServer"  Features stored in state servers: this method is used when user session information needs to be maintained across servers. But the information is stored on the state server, 1 When the status server fails, the information is lost. mode="SqlServer"  Stored in the sql server Features: the workload will increase, but the information will not be lost.  
stateConnectionString : specify asp.net The application stores the server name for the remote session state, which is native by default.  
sqlConnectionString : this is where the connection string is set when using the session-state database.  
Cookieless : set to flase , is used cookie Session state to identify the customer.  
timeout : represents the session timeout time. --> 
<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> 
<!-- for  ASP.NET  Application configuration page view state Settings. Sets the number of items to be stored in the page history. --> 
<sessionPageState historySize="9"/> 
<!-- configuration asp.net http Setup of the runtime. The maximum number of requests allowed can be declared at the computer, site, application, and subdirectory levels 100 , the maximum allowed time to execute the request is 80 Second, controls the user to upload the file size , The default is 4M . useFullyQualifiedRedirectUrl Client redirects do not need to be automatically converted to a fully qualified format. --> 
<httpRuntime appRequestQueueLimit="100" executionTimeout="80" maxRequestLength="40960" useFullyQualifiedRedirectUrl="false"/> 
<!--httpModules in 1 Within the application  HTTP  The module. --> 
<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" /> 
<!-- The custom of URL rewrite ,type It's basically dll The name --> 
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" /> 
<add name="Profile" type="System.Web.Profile.ProfileModule" /> 
</httpModules> 
<!--httpHandlers Used on request by the user URL and HTTP The predicate passes the user's request to the corresponding handler. This node can be configured at any level of the configuration level, which means that special processing can be done for special files specified in a particular directory.  
add : specifies the predicate mapped to the handler / The path.  
clear : removes all handler mappings that are currently configured or inherited.  
remove : removes the predicate mapped to the handler / The path. remove  The instruction must be with the preceding 1 a  add  Predicate of instruction / The path combination matches exactly. This directive does not support wildcards. --> 
<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> 
<!-- for  Web  Used by applications  Cookie  Configure properties.  
domain Set:  Cookie  The domain name.  
httpOnlyCookies In:  Internet Explorer 6 SP1  enable  HttpOnlyCookies Cookie  The output. The default value is  false .  
requireSSL : get 1 Indicates whether a secure socket layer is required  (SSL)  The value of the communication .--> 
<httpCookies httpOnlyCookies="false" requireSSL="false"/> 
<!-- control  ASP.NET Web  The behavior of the service and its clients.  
protocols : specifies the transport protocol, ASP.NET  These transport protocols can be used to decrypt  HTTP--> 
<webServices> 
<protocols> 
<add/> 
</protocols> 
</webServices> 
<!-- for  Web  Application configuration cache Settings.  
cache : defines global application cache Settings.  
outputCache : specifies application-wide output cache Settings.  
outputCacheSettings : specifies the output cache Settings that can be applied to pages in the application.  
sqlCacheDependency : in order to  ASP.NET  Application configuration  SQL  Cache dependencies. --> 
<caching> 
<cache disableMemoryCollection = "false" disableExpiration = "false" privateBytesLimit = "0" percentagePhysicalMemoryUsedLimit = "90" privateBytesPollTime = "00:02:00"/> 
<!-- When designing a page that needs to be cached in this way, you need to add the following instructions to the page: <%@ OutputCache CacheProfile="ServerOnly" %>--> 
<outputCacheSettings> 
<outputCacheProfiles> 
<add name="ServerOnly" duration="60" varyByCustom="browser" location="Server" /> 
</outputCacheProfiles> 
</outputCacheSettings> 
</caching> 
</system.web> 
</location> 
<!-- Network Settings. authenticationModules : specified for pairs  Internet  Request the authentication module. connectionManagement : specify and  Internet  The maximum number of connections to a host. defaultProxy : configure the hypertext transfer protocol  (HTTP)  Proxy server. mailSettings : configure the simple mail transfer protocol  (SMTP)  Mail sending options. requestCaching : controls the caching mechanism of network requests. settings Configuration:  System.Net  Basic network options. --> 
<system.net> 
<!-- configuration SMTP Email Settings --> 
<mailSettings> 
<smtp from="sy"> 
<network host="Gao" password="" userName="" /> 
</smtp> 
</mailSettings> 
<!-- Disable all caches --> 
<requestCaching disableAllCaching="true"></requestCaching> 
<!-- Specify the proxy address and access to the local and  contoso.com  Skip the proxy. --> 
<defaultProxy> 
<proxy usesystemdefault="True" proxyaddress="http://192.168.1.10:3128" bypassonlocal="True"/> 
<bypasslist> 
<add address="" /> 
</bypasslist> 
</defaultProxy> 
</system.net> 
<!-- The section is replaced in  httpHandlers  and  httpModules  The and added in section  AJAX  The relevant  HTTP  Handlers and modules. This section makes  IIS 7.0  These handlers and modules can be used when running in integration mode. in iis7.0  Run under  ASP.NET AJAX  Need to be  system.webServer Section. For earlier versions  IIS  This section is not required.  --> 
<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> 
<!--ASP.NET AJAX  In the configuration  ASP.NET  service --> 
<system.web.extensions> 
<!-- configuration  JSON  serialization --> 
<scripting> 
<webServices> 
<jsonSerialization maxJsonLength="5000"/> 
</webServices> 
</scripting> 
</system.web.extensions> 
<!-- right WCF Related configuration --> 
<system.serviceModel> 
<services> 
<service name="WCFStudent.WCFStudentText" behaviorConfiguration="ServiceBehavior"> 
<!-- Service Endpoints --> 
<endpoint address="" binding="wsHttpBinding" contract="WCFStudent.IStuServiceContract"> 
<!--  When deploying, the following identity elements should be removed or replaced to reflect the identity under which the deployed service is running. And when I delete it, WCF  The corresponding identification is automatically derived. --> 
<identity> 
<dns value="localhost"/> 
</identity> 
</endpoint> 
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
</service> 
</services> 
<behaviors> 
<serviceBehaviors> 
<behavior name="ServiceBehavior"> 
<!--  To avoid leaking metadata information, set the following value to  false  And delete the metadata endpoint above  --> 
<serviceMetadata httpGetEnabled="true"/> 
<!--  To receive fault exception details for debugging, set the following value to  true . Set to before deployment  false  To avoid leaking abnormal information --> 
<serviceDebug includeExceptionDetailInFaults="false"/> 
</behavior> 
</serviceBehaviors> 
</behaviors> 
</system.serviceModel> 
<!--URL redirect --> 
<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> 

Related articles: