Why AppSettings?

Topics: ASP.NET MVC, General
Apr 30, 2013 at 2:15 PM
I have been wondering this for ages, so here it goes...

Why has ASP.NET MVC decided to go with AppSettings for settings instead of custom configuration sections as all the other MS products?

I know in the end its all the same, but its quite strange to have such a big framework without a dedicated section like "<system.web.mvc>".
Coordinator
Apr 30, 2013 at 5:00 PM
Hi nvivo,

The main reason why we haven't created a custom section for it is that MVC so far hasn't had a very big need for configuration settings in general. Most of the settings in MVC are generally set programmatically in the web application's App_Start event. So for the few cases where a developer might want to set a configuration value in config, the "cost" of setting it with a custom config section is much higher, and we wanted to avoid that. To enable custom config each web.config file would need to have the custom config sections registered at the top (which could easily be 5 - 6 lines of XML), and this is unfortunately very verbose, and is not something easy to memorize (or even understand!).

By using <appSettings> it's exactly one line of copy & paste to set each value. You do lose out on Intellisense, but as I mentioned earlier, most settings are set programmatically anyway in App_Start, where you get full Intellisense anyway.

Thanks,
Eilon
Apr 30, 2013 at 8:20 PM
This is exactly the type of answer I was looking for, that is enough for my curiosity. =)

Thanks Eilon.