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