You have to keep in mind *. config-configuration file

Source: Internet
Author: User

When we first wrote the Web application, we soon had access to a file, which was the configuration file--web.config. Our first more profound use is that we do not need to put our database links scattered in our code, we only need to note in the Web. config file, so we can easily read it when we need it, change it. So what is a configuration file? What is it used to do? We can look at the definition of the user profile in the Windows operating system: we can see the configuration file to help us pre-set some basic parameters, conditions. It can be used to help our processes, applications, or operating systems run in our pre-set environment. Really understanding and understanding profiles can help us better understand how our application entanglements work. In our web application development, testing the deployment process, there are three profiles also need us to get a good understanding, and remember them. They were: machine.config, applicationhost.config, Web. config Machine.config  In fact, when we do development, there is a very important principle is: We write all the code, the creation of all the files are for people to see, and to the machine to see our compiled files. So from the file name we can extrapolate that this file is all the information that is for all Web applications within the entire server. The exact location of the Machine.config file is under the%system32%microsoft.netframework[version number]config directory. Web. config
Web. config inherits from the Machine.config file, and we can separate settings for specific web.application files.

Memory points:

configsections: Configuration section handler declaration. Usually we will declare here the node we need to set, and later set the detail value, or property, in the node.

AppSetting: Specific application configuration. Here we can easily help us to specify some simple, basic settings for the application. For example, we have a marketplace activity app and we need to set

A controllable store activity start and end time, which we can set here.

System. WEB: Controls the behavior of the ASP.

CustomErrors: Custom Exception mode: Has a on,off,remoteonly of 3 states.   On means that custom information is always displayed; Off means that detailed ASP. NET error information is always displayed;

RemoteOnly indicates that custom information is displayed only for users who are not running on the local Web server.

For exceptions of different states, we can specify the prompt page for the.

SessionState: Session configuration Inproc in-process storage, stateserver third-party state server storage, SQL Server database storage. In different scenarios or requirements,

We can specify how our session state is stored.

Authentication:windows, Forms, PassPort, None


HttpRuntime: Configure the ASP. NET HTTP runtime settings. This section can be declared at the machine, site, application, and subdirectory levels.

Example: Control user upload file up to 4M, maximum time 60 seconds, maximum number of requests is 100

Httpmodule:module custom settings, you can go unless required module, or custom module, such as Prevent hotlinking, IP security management, etc.

Httphandler:handler custom settings, or add custom handler

applicationhost.configIIS provides us with a highly integrated Web application platform for managing and running our Web applications. And for iis7.0+ use ApplicationHost.config Save the IIS configuration for the Web server and process. ApplicationHost.config is under the%system32%inetsvr\config directory.    Memory points:  1, application pool settings:<system.applicationhost>        <applicationPools>             <add name= "DefaultAppPool" managedruntimeversion= "v4.0"/>    & nbsp       <add name= "ASP v4.0" managedruntimeversion= "v4.0"/>          &NBS P <add name= "ASP v4.0 Classic" managedruntimeversion= "v4.0" managedpipelinemode= "classic"/>            <applicationPoolDefaults>                <pro Cessmodel identitytype= "Applicationpoolidentity" loaduserprofile= "true" setprofileenvironment= "false"/>            </applicationPoolDefaults>        </applicationpools &GT;2, developing deployment locations and access protocols for specific sites, ports  <sites>            <site name= "Default Web Site" Id= "1" serverautostart= "true" >               <application path= "/" >              &NB Sp     <virtualdirectory path= "/" physicalpath= "e:\*"/>              &NBS P </application>                <bindings>        &N Bsp           <binding protocol= "http" bindinginformation= "*:80:"/>3, set global module for ASP. , HTTP cache, anonymous authentication       <globalModules>            <add name= "HttpCache Module "image="%windir%\system32\inetsrv\cachhttp.dll "/>            <add name=" Anonymousauthenticationmodule "image="%windir%\system32\inetsrv\authanon.dll "/>        </ globalmodules>        Here let us know when our HTTP cache was processed and where it was loaded. We can also specify custom cache handling.  4, to filter the request, to determine whether the request is an ASP. NET Dynamic page request, if it is passed to aspnet_wp,Line request and return html     <isapiFilters>            <filter name= "asp.net_ 4.0_64bit "path=" C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_filter.dll "enablecache=" true " precondition= "Runtimeversionv4.0,bitness64"/>            <filter name= "asp.net_ 4.0_32bit "path=" C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_filter.dll "enablecache=" true "precondition = "Runtimeversionv4.0,bitness32"/>        </isapiFilters>  In fact, for the configuration file, you need to focus on more than these classes, A lot of things can not be shown for the time being. But the settings for these three profiles can really help us understand how the entire Web application environment works.  

You have to keep in mind *. config-configuration file

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.