Web.config 和 App.config 区别
web.config is used with web applications. web.config will by default have several configurations required for the web application. You can have a web.config for each folder under your web application.
app.config is used for windows applications. When you build the application in vs.net, it will be automatically renamed to <appname>.exe.config and this file has to be delivered along with your application.
You can use the same method to call the appsettings values from both config files :
System.Configuration.COnfigurationSettings.AppSettings["Key"]
------
If you make any changes to the web.config, web application will immediately load the changed config. But in case of <application name>.exe.config, you have to restart the application.
------
What about console applications? They don't seem to have an app.config file when I create such a project in Visual Studio. However, I'm working with the Logging Application Block sample apps, and the console ones have an app.config file. I don't know if that config file was manually created by whoever made the sample, or if it is supposed to be automatically added to the project somehow.
Simon.
-----
app.config is not automatically added. You can go to the solution explorer, select 'Add new item' and add the 'Application Configuration File'.
-----
I am not very sure about whether any other difference is there in both. From the notes i read i found that
An app.config file is called "app.config" because it is the configuration
file for an application, it cannot be used for a class library.
web.config is an ASP.Net app.config file
Both
enable application to have its own configuration.
Suppose for example you have a c# class library with app.config in your asp.net project with web.config then the project will refer only web.config as the project is an asp.net project though the project includes c# and app.config.
If you found some other details in this topic do forward me
to veenswats2006@yahoo.co.in
-----
more @ : http://www.dotnetspider.com/forum/ViewForum.aspx?ForumId=21
posted on 2009-05-02 16:46 smwikipedia 阅读(1363) 评论(0) 编辑 收藏 举报