Talk about Web. config and app. Config

Source: Internet
Author: User

When it comes to Web. config and app. Config everyone is familiar with, we all call them configuration files, usually use more, less attention. What is the difference between the two, very simple, one sentence: if it is a Web program, such as the WebForm project type and the MVC project type is Web. config, if it is a class library or WinForm program or other non-interface project is app. config.

In general, when using the daily situation, in VS, when you need to add a configuration file to the specified project, you add a new item, when you select the profile, VS will automatically recognize the current project type, and add the relevant configuration file, why do I propose it, the cause is this: Last week in the process of modifying an old project , because the project is too large and needs to rely on other system platform so it is not convenient to deploy directly in the native debugging, and I have to debug some of the methods, the simple way is to add unit test project, and add the corresponding method of testing method, after this process, in the Run unit test debugging process, To the DAO layer one to initialize the class when the error, do not know, ah, all kinds of attempts still unsuccessful, and later knew because of the framework constraints, need to read a specific configuration, so I will be the Web project under the config file copied to the test project, and then ... Then there is no then, continue to error, I le a go, all kinds of toss Ah, think the key to find the wrong problem, and later found that the same as before, the explanation or less configuration, that is, the configuration is not actually read, so depressed, the web after completely no problem ah, well, I add it manually, The resulting configuration file is app. Config, which instantly looks great and adds a configuration in app. Config.

Alas, itself is no technical content of things, but did not pay attention to the details ah, so write, for novice reference, also remind yourself to pay attention to details, the great god over it!

Talk about Web. config and app. Config

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.