.NET 4 refactoring web.config files - what is the meaning?

According to what's new in .NET 4 : "The basic configuration items have been moved to the machine.config file, and applications now inherit these settings."

I am upgrading a project from .NET 3.5 to .NET 4, and I have some questions about this change:

  • I assume this change is not required: if I leave my current web.config file as it is, it should work just fine in .NET 4 - right?
  • This improvement seems to be of dubious value: the configuration has not been simplified - the complexity / bloat has just been moved to the machine.config file instead of web.config. Did I miss something?
  • It looks like this improvement actually makes deployment difficult: in addition to the deployment steps that we already had, now we also need to modify the machine.config file to contain our expected settings / values.

As you can see, my initial approach to this is: it is a hassle, and I do not want to do this. Is there any perspective that I am missing that makes this change particularly useful and valuable?

EDIT: Nathan and Rob - both of your answers were very helpful and appreciated - it was hard to decide which flag is the “real” answer. Of course, I supported them both. Thanks again!

+3
source share
2 answers

machine.config, , , .

, web.config, "" , .NET 3 3.5. ASP.NET , .., , .

, , , " " , , , .

ScottGu : http://weblogs.asp.net/scottgu/archive/2009/08/25/clean-web-config-files-vs-2010-and-net-4-0-series.aspx

+2

, web.config .net 1.0 .net 3.5, "" . , .net 3.5, , . , asp.net, !

, machine.config , web.config. , , .net 1.1 → .net 3.5, web.config, Visual Studio, - machine.config, Microsoft . :

<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>

Visual Studio 2008 web.config, Visual Studio 2010 web.config, machine.config , ( .net 3.0/.net 3.5, CLS.net 2.0).

, , .net 4.0 "" web.config . , web.config , web.config machine.config.

+2

Source: https://habr.com/ru/post/1792927/


All Articles