为什么我必须从web.config中删除行才能升级到.net 4.0?

时间:2012-03-16 15:44:46

标签: asp.net web-config

我开始使用ASP.net 3.5 Web应用程序并升级到ASP.net 4.0。当我在Visual Studio 2010调试器中的开发工作站上运行应用程序时,一切似乎都很好。但是,当我将应用程序推送到我的开发Web服务器时,我不断收到错误消息,我通过在我以前工作的应用程序中注释掉web.config中的一些行来解决这个问题:

<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
  <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    <!--<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>-->
    <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <!--<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>-->
      <!--<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>-->
      <!--<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>-->
      <!--<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>-->
    </sectionGroup>
  </sectionGroup>
</sectionGroup>

有人可以向我解释为什么我必须这样做才能让我的应用程序在我的带有.net 4.0的开发Web服务器上运行吗?

1 个答案:

答案 0 :(得分:6)

我必须多次这样做!基本上在.Net4中,很多东西被提升为machine.config,所以在web.config

中不再需要了