Detailed examples of the web. config file

Source: Internet
Author: User

[To] http://hi.baidu.com/jinzhu160/blog/item/24003b09eca730a52fddd4e8.html

I sorted it out. You can copy it to an XML file for ease of viewing.

<? XML version = "1.0"?>

<! -- Note: In addition to manually editing this file, you can also use web management tools to configure applications.Program. You can use the "website"> "ASP. NET configuration" option in Visual Studio.
The complete list of settings and comments is in machine. config. Comments. This file is usually located in "Windows" Microsoft. NET "Framework" v2.x "config. -->
<! -- The webconfig file is an XML file, and configuration is the root node of the XML file. Because only one of the root nodes of the XML file can exist, all the configurations of webconfig are carried out in this node. -->
<Configuration>

<! -- Specify the configuration section and namespace declaration.
Clear: removes all references to inherited sections and section groups. Only the sections and section groups added by the current section and sectiongroup elements are allowed.
Remove: removes references to inherited sections and 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 an application setting that defines global constant settings and other information of an application. -->
<Deleetask>
<Add key = "1" value = "1"/>
<Add key = "Gao" value = "weipeng"/>
</Appsettings>

<! -- Connection string settings -->
<Connectionstrings>
<Add name = "connstring" connectionstring = "Data Source = Gao; initial catalog = hbwxdate; user id = sa; Password = sa"> </Add>
<Add name = "111" connectionstring = "11111"/>
</Connectionstrings>

<! -- Specify the resources configured for the Application sub-configuration and lock the configuration settings to prevent them from being overwritten by the configuration file. Page specifies the resource of configuration settings contained in the application. Whether AllowOverride allows rewriting of configuration files to improve the security of configuration files -->
<Location Path = "default. aspx" AllowOverride = "false">

<! -- Control Asp.net runtime behavior -->
<System. Web>
<! -- Identity controls the authentication identity of Web applications. -->
<Identity impersonate = "false"/>

can be declared at the computer, site, application, and subdirectory level.
the following attributes indicate that the default homepage is index and the topic is default. This attribute does not detect potential dangerous data in the content entered by the browser. (Note: this check item is checked by default. If you do not use this check item, you must encode or verify the user input.) The encrypted view status will be checked when the client returns the page, to verify whether the view status has been tampered with on the client. (Note: This item is not verified by default) disable viewstate -->





<! -- Default error page settings, mode: With On, off, remoteonly three states. On indicates that custom information is always displayed; Off indicates that detailed Asp.net error information is always displayed; remoteonly indicates that custom information is only displayed for users not running on the Local Web server. defaultredirect: the URL used for redirection when an error occurs -->
<Customerrors defaultredirect = "err.html" mode = "remoteonly">
<! -- SpecialCodeNumber error from the targeted file -->
<Error statuscode = "403" Redirect = "noaccess.htm"/>
<Error statuscode = "404" Redirect = "filenotfound.htm"/>
</Customerrors>

<! -- Configure debugging and tracing: The following configuration means to start debugging (default), capture tracing information, the number of trace requests to be cached (15), and sort tracing results. -->
<Trace enabled = "true" localonly = "false" pageoutput = "true" requestlimit = "15" tracemode = "sortbycategory"/>

<! -- Set compilation DEBUG = "true" to insert the debugging symbol into the compiled page. However, this affects performance, so this value is set to true only during development. Set the default development language C #. Whether batch supports batch processing -->
<Compilation DEBUG = "true" defaultlanguage = "C #" batch = "false">
<Assemblies>
<! -- Added assembly reference. Every time an assembly is added, it indicates that your application has depended on an assembly and you can use it 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>

<! -- Define a set of providers used to compile 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>

section, you can configure the Security Authentication mode used by ASP. NET to identify the passed-in user. Windows: use IIS authentication, forms: use form-based authentication, passport: Use passport cookie Authentication mode, none: no authentication method is used -->

you can set "all" to encrypt the data and verify the validity. "None" indicates that the cookie is not protected, and "encryption" indicates that the cookie content is encrypted, validation indicates the validity of the cookie content. Timeout: Specifies the cookie expiration time. after timeout, you must log on again. -->

<! -- Control access to the client of the URL Resource (for example, Anonymous Users are allowed to access the resource ). This element can be declared at any level (computer, site, application, subdirectory or page. Must be used with the <authentication> section. This means that anonymous users are not authenticated. Reject user weipeng -->
<Authorization>
<Allow users = "*"/>
<Deny users = "weipeng"/>
<Allow users = "AA" roles = "AA"/>
</Authorization>

<! -- Website globalization settings, requestencoding: used to check the encoding of each request. responseencoding: used to check the encoding of the returned response content. fileencoding: used to check the default encoding for parsing files such as aspx and asax. The default encoding is UTF-8 -->
<Globalization requestencoding = "gb2312" responseencoding = "gb2312" fileencoding = "gb2312"/>

<! -- Sets the session status. Mode: divided into off, inproc, StateServer, sqlserver several statuses mode = inproc storage features in the process: has the best performance, the fastest speed, but cannot be shared across multiple servers. mode = "StateServer" is stored in a status server. Features: This method is used when user session information needs to be maintained across servers. However, the information is stored on the Status server. If the status server fails, the information will be lost. mode = "sqlserver" is stored in SQL Server. features: the workload will increase, but the information will not be lost.
Stateconnectionstring: Specifies the name of the server in which the Asp.net application stores the remote session status. The default value is local. Sqlconnectionstring: When a database in session status is used, set the connection string here. Cookieless: When set to flase, it indicates that the client is identified by the Cookie Session status. Timeout indicates 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>
<! -- Set the view status on the ASP. NET application configuration page. Set the number of items to be stored in the page history. -->
<Sessionpagestate historysize = "9"/>

<! -- Configure Asp.net HTTP Runtime Library settings. Can be declared at the computer, site, application, and sub-directory level
The maximum number of requests allowed is 100. The maximum request execution time is 80 seconds. The size of the uploaded files is controlled. The default value is 4 MB. Usefullyqualifiedredirecturl client redirection does not need to be automatically converted to a fully qualified format. -->
<Httpruntime apprequestqueuelimit = "100" executiontimeout = "80" maxrequestlength = "40960" usefullyqualifiedredirecturl = "false"/>

<! -- Httpmodules configures the HTTP module in an application. -->
<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"/>
<! -- Rewrite the custom URL. The type is basically the DLL name. -->
<Add name = "urlrewriter" type = "intelligencia. urlrewriter. rewriterhttpmodule, intelligencia. urlrewriter"/>
<Add name = "Profile" type = "system. Web. profile. profilemodule"/>
</Httpmodules>

<! -- Httphandlers is used to send a user's request to the corresponding handler Based on the URL and HTTP predicate of the user request. You can configure this node at any configuration level, that is, you can perform special processing on the specified special files in a specific directory.
Add: Specifies the predicate/path mapped to the handler. Clear: removes all currently configured or inherited handler mappings. Remove: remove the predicate/path mapped to the handler. The remove command must exactly match the predicate/path combination of the previous add command. This command 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>

<! -- Configure attributes for cookies used by web applications. Domain: Set the cookie domain name. Httponlycookies: Enable httponlycookie output in Internet Explorer 6 SP1. The default value is false. Requiressl: gets a value indicating whether Secure Socket Layer (SSL) communication is required. -->
<Httpcookies httponlycookies = "false" requiressl = "false"/>

<! -- Controls the behavior of ASP. NET web services and their clients. Protocols: Specifies the transmission protocol. ASP. NET can use these transmission protocols to decrypt HTTP -->
<WebServices>
<Protocols>
<Add/>
</Protocols>
</WebServices>

<! -- Configure cache settings for Web applications. Cache: defines global application cache settings. Outputcache: Specifies the output cache settings within the application range. Outputcachesettings: Specifies the output cache settings that can be applied to pages in applications. Sqlcachedependency: Configure SQL cache dependencies for ASP. NET applications. -->
<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 command to the page: <% @ outputcache cacheprofile = "serveronly" %> -->
<Outputcachesettings>
<Outputcacheprofiles>
<Add name = "serveronly" Duration = "60" varybycustom = "Browser" location = "server"/>
</Outputcacheprofiles>
</Outputcachesettings>
</Caching>
</System. Web>
</Location>

<! -- Network setting, authenticationmodules: indicates the module used to authenticate Internet requests. Connectionmanagement: specifies the maximum number of connections to the Internet host. Defaultproxy: configure the Hypertext Transfer Protocol (HTTP) proxy server.
Mailsettings: configure the mail sending option for the Simple Mail Transmission Protocol (SMTP. Requestcaching: controls the cache mechanism of network requests. Settings: Configure basic network options for system. net. -->
<System.net>
<! -- Configure SMTP email settings -->
<Mailsettings>
<SMTP from = "weipeng">
<Network host = "Gao" Password = "" username = ""/>
</SMTP>
</Mailsettings>

<! -- Disable all caches -->
<Requestcaching disableallcaching = "true"> </requestcaching>

<! -- Specifies the proxy address and skips the proxy for local access and contoso.com. -->
<Defaultproxy>
<Proxy usesystemdefault = "true" proxyaddress = "http: // 192.168.1.10: 3128" bypassonlocal = "true"/>
<Bypasslist>
<Add address = "[A-Z] +". contoso = ". com"/>
</Bypasslist>
</Defaultproxy>
</System.net>

<! -- This section replaces the Ajax-related HTTP processing programs and modules added in httphandlers and httpmodules. This section enables IIS 7.0 to use these processing programs and modules when running in integrated mode. To run ASP. NET Ajax under iis7.0, system. WebServer is required.
Section. This section is not required for earlier versions of IIS. -->
<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>

<! -- Configure ASP. NET service in ASP. NET Ajax -->
<System. Web. Extensions>
<! -- Configure JSON serialization -->
<Scripting>
<WebServices>
<Jsonserialization maxjsonlength = "5000" type = "codeph" text = "/codeph"/>
</WebServices>
</Scripting>
</System. Web. Extensions>

<! -- Configure WCF -->
<System. servicemodel>
<Services>
<Service name = "wcfstudent. wcfstudenttext" behaviorconfiguration = "servicebehavior">
<! -- Service endpoints -->
<Endpoint address = "" binding = "wshttpbinding" Contract = "wcfstudent. istuservicecontract">
<! -- During deployment, the following identification elements should be deleted or replaced to reflect the identity of the deployed service under it. After deletion, WCF automatically derives the corresponding identifier. -->
<Identity>
<DNS value = "localhost"/>
</Identity>
</Endpoint>
<Endpoint address = "mex" binding = "mexhttpbinding" Contract = "imetadataexchange"/>
</Service>
</Services>

<Behaviors>
<Servicebehaviors>
<Behavior name = "servicebehavior">
<! -- To avoid metadata leakage, set the following value to false before deployment and delete the above metadata endpoint -->
<Servicemetadata httpgetenabled = "true"/>
<! -- To receive fault exception details for debugging, set the following value to true. Set it to false before deployment to avoid leakage of exception information -->
<Servicedebug includeexceptiondetailinfaults = "false"/>
</Behavior>
</Servicebehaviors>
</Behaviors>
</System. servicemodel>









Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.