web.config is used with web application. 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.

 

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.


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.

 

相关文章:

  • 2021-11-12
  • 2021-10-27
  • 2021-06-17
  • 2021-08-17
  • 2021-12-05
  • 2021-05-13
  • 2022-02-01
  • 2021-10-25
猜你喜欢
  • 2021-04-20
  • 2021-10-19
  • 2021-11-02
  • 2021-05-22
  • 2021-10-10
  • 2021-08-14
相关资源
相似解决方案