正如@BNL说我从this站点引用答案,
步骤1(IIS 7或IIS 7.5只)
这一步是必要只在运行的操作系统IIS 7或IIS 7.5,其中包括Windows Vista,Windows Server 2008,Windows 7和Windows Server 2008 R2。
将父应用程序(运行ASP.NET 2.0或ASP.NET 3.5的应用程序)的Web.config文件中的configSections定义移动到.NET Framework 2.0的根Web.config文件中。 IIS 7和IIS 7.5本机配置系统在合并配置文件的层次结构时扫描configSections元素。将configSections定义从父Web应用程序的Web.config文件移动到根Web.config文件,有效地隐藏了子ASP.NET 4应用程序出现的配置合并过程中的元素。
在32位操作系统或32位应用程序池,用于ASP.NET 2.0和ASP.NET 3.5通常位于下面的文件夹根Web.config文件:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG
在64位操作系统或64位应用程序池,用于ASP.NET 2.0和ASP.NET 3.5通常位于下面的文件夹根Web.config文件:
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG
如果运行都32位和64位Web应用程序在64位计算机上,您必须将configSections元素向上移动到r用于32位和64位系统的Web.config文件。
当您将configSections元素放入根Web.config文件中时,请将该部分粘贴到配置元素之后。以下示例显示完成移动元素后,根Web.config文件的顶部部分应该是什么样子。
注意在下面的示例中,为了便于阅读,行已换行。
<?xml version="1.0" encoding="utf-8"?>
<!-- The root web configuration file -->
<configuration>
<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>
</configSections>
步骤2(IIS的所有版本)
的ASP.NET 4子Web应用程序是在IIS 6或IIS 7运行该步骤是必需的(或IIS 7.5)。
在运行ASP.NET 2或ASP.NET 3.5的父Web应用程序的Web.config文件中,添加一个位置标记,该标记明确指定(对于IIS和ASP.NET配置系统)配置条目仅适用于父级Web应用程序。下面的示例示出了位置元件的语法添加:
<location path="" inheritInChildApplications="false" >
下面的示例示出了位置标签如何用于包裹开始appSettings部分,并与系统结束所有构成部分。 webServer部分。
<location path="" inheritInChildApplications="false" >
当您完成步骤1和2,儿童ASP.NET 4 Web应用程序将启动没有错误。
这就是IIS的配置工作原理;每个级别都从它上面的级别继承。这应该给你一个暗示,你是否可以*做你正在做的事情...... – 2012-01-16 12:18:05
你能告诉我如何部署这个应用程序吗?我需要创建一个新的网站吗? – user960567 2012-01-16 12:23:18
我刚刚找到inheritInChildApplications。检查此 – user960567 2012-01-16 12:33:12