Web. config User Guide, web. config Guide

Source: Internet
Author: User

Web. config User Guide, web. config Guide

<ConnectionStrings configSource = "db. config"/>

External file db. config:

Copy codeThe Code is as follows:
<ConnectionStrings>
<Add name = "DefaultConnection" connectionString = "Data Source = (LocalDb) \ v11.0; Initial Catalog = aspnet-WebApplication1-20140304225906; Integrated Security = SSPI; AttachDBFilename = | DataDirectory | \ aspnet-WebApplication1-20140304225906.mdf"
ProviderName = "System. Data. SqlClient"/>
<Add name = "ReportServerTempDBConnectionString" connectionString = "Data Source =.; Initial Catalog = ReportServerTempDB; Integrated Security = True"
ProviderName = "System. Data. SqlClient"/>
</ConnectionStrings>

Specific format

<Node name configSource = "configuration file path"/>

Notes

1. if configSource is specified, the external files shall prevail. the node configuration under connectionStrings in config is invalid, even if the web. the connection string nodes under connectionStrings in config are invalid if they are not deleted.

2. The root node of the external file must be the same as the node specified in web. config (in fact, the node configuration is moved to the external file)

3. One node can only specify one external configuration file. You cannot specify the external files of multiple nodes as the same. For example, you cannot specify the configSource of connectionStrings and appSettings as the same file.

Node Data Acquisition

ConfigurationManager. GetSection ("node name"); // a Node object is returned.

Hypothetical: After the setup, ASP. NET5 is cross-platform and json is used as the configuration file. It can also be implemented!

The above is all the content of this article. I hope you will like it.

Related Article

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.