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

  • 相关阅读:
    Beginning Python From Novice To Professional读书笔记
    Google's Python Class
    Screen scraping 3
    Screen scraping 1
    Screen scraping 2
    《发现你的销售力量》读书笔记
    不可思议的每日培训
    “项目计划与跟踪最佳实践”讲座(2010年7月)现接受企业申请
    “活用类图,把握需求主动权”讲座(2010年6月)现接受企业申请
    项目健康状况检查
  • 原文地址:https://www.cnblogs.com/smwikipedia/p/1447811.html
Copyright © 2011-2022 走看看