Config file configuration facade

xiaoxiao2021-03-06  56

After adding the web.config file in ASP.NET, everyone is attracted by it, because the content placed in Config does not need to recompile, which provides a great convenience for publishing applications. In the program, I also saw a variety of uses for the config file. Now they are now as follows:

1. Database connection string. Place the database connection string in the Config file basically became a standard practice, so we can make the database connection when publishing programs, without having to compile programs.

2. Mail Send server, send account information. In development, we will also send a message to the server, save the information such as the account to be saved in the We.config file, and the user can freely set the mail sending server.

3. When doing a web program, we often need paging. If you write in the program, you can change it, so we write this information in config, users can customize it according to their own preferences.

4. Do you want to support SSL for security reasons, the server sometimes requires support SSL, but our own machine may not, so for some procedures for SSL special processing, we need to determine according to a attribute in Config. In this way, we can easily publish the program on a server that supports or does not support SSL.

5. For HTTPHandler's processing, when you look at the .Text program, you will find that for different file suffixes, .text has different classes to handle it. How do I find these related classes? There is a blog.config file in the program, which has specific correspondence with those classes.

6. Version information When studying the NET Advantage control, it was found that its SAMPLE didn't work, and the background was in the help of the support personnel, in knowing that we need to modify a version information in the config file.

7. When the configuration information at hierarchical transmission When you look at ShadowFax's code, we found that when you provide a service layer interface, we need to save the class to the class and the transmission method in a config file, and CONFIG configuration information is almost everywhere when developing a service-oriented application using EDRA (Enterprise Development Reference Architecture).

转载请注明原文地址:https://www.9cbs.com/read-82348.html

New Post(0)