Can someone provide a quick App.config/Web.config tutorial?
I've used these two configuration files many times before, but I've never taken the time to fully understand how they really work. As most people do, I understand the basics in how to call WebConfigurationManager.AppSettings["key"]
to get config values.
Here are some questions I came up with:
The underlying answer to all of your questions is the same: Unless you set up something unusual, all assemblies in your project will read from the same configuration file. In a web app, they will all read from "web.config". In any other project type, they will read from the starting assembly's config file.
The app/ web.config that is used is the one that starts the process. Easier if I give an example:
In this case code in project A and B will use the app.config in project A . Code in project C and D will use the web.config in project C .
链接地址: http://www.djcxy.com/p/21092.html