【问题标题】:Hosting .Net 4 website as child of .Net 3.5 website将 .Net 4 网站作为 .Net 3.5 网站的子网站托管
【发布时间】:2010-06-15 15:42:23
【问题描述】:

我正在尝试将在 .Net 4 应用程序池上运行的 Silverlight 应用程序添加为在经典 .Net 应用程序池上运行的 ASP.Net 应用程序的子应用程序。由于 Silverlight 应用程序从父应用程序继承配置元素,我收到几个配置错误。有谁知道可以帮助阐明完成此任务的过程的文章或一些基本步骤?

谢谢

【问题讨论】:

    标签: .net asp.net .net-3.5 iis-7 silverlight-4.0


    【解决方案1】:

    将 system.web.extensions sectionGroup 从父 3.5 web.config 移动到机器上的根 2.0 web.config。您可能不必移动所有部分,只需移动“system.web.extensions”。 2.0 根 web.config 位于此处:C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG 或此处:C:\Windows\Microsoft.NET\Framework64\v2.0.50727\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>    
    </configSections>
    

    必须更改根 web.config 似乎很奇怪,但它确实有效。

    您还需要在父 web.config 中使用如下位置标签包装部分:

    <location path="" inheritInChildApplications="false" >
      <appSettings />
      <connectionStrings />
      <system.web>
        <!-- Removed for brevity -->
      </system.web>
      <system.codedom>
        <!-- Removed for brevity -->
      </system.codedom>
      <system.webServer>
        <!-- Removed for brevity -->
      </system.webServer>
    </location>
    

    看这里:

    ASP.NET 4 Child Applications Fail to Start When Under ASP.NET 2.0 or ASP.NET 3.5 Applications

    【讨论】:

      【解决方案2】:

      这两个应用程序(.NET 3.5 和 .NET 4)需要在不同的应用程序池中运行。

      即包含 .NET 4 应用程序的子文件夹需要是它自己的应用程序,分配给不同的应用程序池。

      但是,两者都不是 Silverlight 应用程序 --- 它们将是服务器配置文件 .NET(Silverlight 没有意义,它用于客户端应用程序,而不是网站)。

      【讨论】:

      • 它们在不同的应用程序池中运行。我收到错误“定义了重复的 'system.web.extensions/scripting/scriptResourceHandler' 部分”我认为这是由于子应用程序从父应用程序继承配置元素的一些问题。有什么想法吗?
      • @Sidney:据我所知,IIS 应用程序根目录中的 web.config 仅继承自机器配置文件(同一文件夹中的 machine.config + web.config)。但这是我的待办事项清单。
      猜你喜欢
      • 1970-01-01
      • 2015-07-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-05
      • 2014-02-26
      • 2011-11-11
      • 2011-04-03
      相关资源
      最近更新 更多