why are there 2 web.config files

后端 未结 4 874
轮回少年
轮回少年 2020-12-29 03:27

Someone sent me over a link to download the sample standard asp.net MVC sample, I noticed that there were 2 web.config files:

  1. 1 in the root directory
4条回答
  •  一整个雨季
    2020-12-29 04:09

    What Silky said, except reworded.

    In ASP .NET there is basically an inheritance style thing going on for config files. You have a machine.config out there in the .net framework folder which has basic settings for all apps on the machine. Anything you specify in a root web.config with the same tags would override the stuff in the machine.config.
    Any web.config in a sub-folder can override or add additional settings within that sub-folder and its children.

    It's always fun for me the first time one of my newer programmers puts in a http handler in a root folder and then all of the apps in the virtual directories under it explode because they don't have the DLL (they should have put the http handler statement only in the app that needed it, not in the root). :)

提交回复
热议问题