According to what’s new in .NET 4: “major configuration elements have been moved to the machine.config file, and applications now inherit these settings.”
I’m on a project upgrading from .NET 3.5 to .NET 4, and I have some questions about this change:
- I assume this change is optional: if I leave my current web.config file as-is, it should run just fine under .NET 4 – correct?
- This enhancement seems to have dubious value: the config hasn’t been simplified – the complexity/bloat has just been relocated to the machine.config file instead of web.config. Am I missing something?
- It seems like this enhancement actually makes deployment more difficult: in addition to the deployment steps we already had, now we also need to modify the machine.config file to ensure it contains our expected settings/values.
As you can see, my initial take on this is: it’s a hassle and I don’t want to do it. Is there some perspective I’m missing that makes this change especially useful and valuable?
EDIT: Nathan and Rob – both your answers were very helpful and greatly appreciated – it was difficult to decide which to flag as the “real” answer. I upvoted both, of course. Thanks again!
You don’t ever need to modify the
machine.configunless you want those settings to be the default for all applications running on the server.Most of what was moved out of the
web.configwere “boilerplate” config items that were added with the release of .NET 3 and 3.5. They were needed by ASP.NET to register controls, handlers, etc, but rarely were they things you would actually need to modify, or care to.So basically this is useful to you because the configuration items that are just “white noise” to you are now moved out of you way, allowing you to focus on the settings you actually want to manipulate.
ScottGu discusses this subject in a blog post of his: http://weblogs.asp.net/scottgu/archive/2009/08/25/clean-web-config-files-vs-2010-and-net-4-0-series.aspx