From my perspective, the web.config
grew and grew between .net 1.0 and .net 3.5 as "stuff" was incrementally added to it. By the time we hit .net 3.5 it was chock full of things that I never used or modified. Yes, it was needed by the asp.net runtime, but that's not my problem!
Unless you've specifically changed a setting that's been migrated to machine.config
for one of your applications, there's no need to re-create it in your web.config. In other words, by shifting all the defaults that were added in .net 1.1 -> .net 3.5 from every web.config created by Visual Studio, ever to machine.config
, Microsoft have made the file cleaner and easier to read. A classic example is this:
<sectionGroup name="System.Web" type="System.Web.Configuration.MicrosoftWebSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false"/>
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false"/>
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>
All that mess can be found in a Visual Studio 2008 generated web.config
, but it's not present in a Visual Studio 2010 generated web.config
as it's been moved to machine.config
where it belongs (but couldn't be moved to in .net 3.0 / .net 3.5 as they still ran on the .net 2.0 CLR).
Thanks to the fact that these were seldom changed, upgrading a project to .net 4.0 and "cleaning" the web.config file should cause no issues. Leaving the redundant configuration in the upgraded projects web.config file should also make no difference as the values in the web.config will simply override the values from the machine.config.