zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    mybatis
    eclipse日志
    最大值与最小值问题
    常见的缓存算法设计策略
    常用垃圾回收算法
    Java中对象的三种状态
    Java中的内存泄漏问题
    单例模式
    约瑟夫环问题
    矩形覆盖问题
  • 原文地址:https://www.cnblogs.com/smwikipedia/p/1447811.html
Copyright © 2011-2022 走看看