Use of configsource in ASP. NET configuration file

Source: Internet
Author: User

Use the following in the default web. config file of the site:

<Etetaskconfigsource = "My. config"/>

Create the my. config file:

<? XML version = "1.0" encoding = "UTF-8"?> <Appsettings> <add key = "test" value = "Hello world."/> </appsettings>

In. NET Framework 2.0, you can configure all configuration elements that support the configsource attribute in a single file. However, when the configsource attribute is used, you must move the entire section to a separate file because there is no combination of element settings. When the configsource attribute is used, a write operation is performed on the Web. config file. This will cause the application to restart, but the subsequent updates to this section will directly write a separate file, without causing the subsequent application to restart.

Can contain only configsource once;

When the website is running, modifying the Web. config file will cause the site to restart, but not modifying the my. config file, which also improves the readability of the 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.