部署ASP.NET MVC 3在ASP.NET 3.5应用网站子文件 [英] Deploying ASP.NET MVC 3 Application Under ASP.NET 3.5 Web Site Sub Folder

查看:243
本文介绍了部署ASP.NET MVC 3在ASP.NET 3.5应用网站子文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在IIS 7,ASP.NET 3.5的网站,效果很好。我刚才安装.NET 4.0本网站的服务器上。现在,我已经在这个网站上添加一个虚拟目录(是的,我转换到这个应用程序)与Asp.Net 4.0程序池。当我访问该虚拟目录,我得到

I have a website in IIS 7, ASP.NET 3.5 which works well. I have just installed .NET 4.0 on this website server. Now, I have added a virtual directory(Yes, I Converted this to Application) with Asp.Net 4.0 AppPool in this website. When I access this Virtual Directory, I get

There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined

为什么这个虚拟目录应用程序试图用根网站的web.config?

Why this Virtual Directory Application trying to use root website's web.config?

推荐答案

由于@BNL说我是从引用的网站,

As @BNL said I am quoting the answer from this site,

第1步(IIS 7或IIS 7.5只)

这一步是必要的只能在运行IIS 7或IIS 7.5的操作系统,其中包括Windows Vista,Windows Server 2008中的Windows 7和Windows Server 2008 R2。

This step is necessary only on operating systems that run IIS 7 or IIS 7.5, which includes Windows Vista, Windows Server 2008, Windows 7, and Windows Server 2008 R2.

移动configSections定义父应用程序转化为the.NET Framework 2.0的根Web.config文件(运行ASP.NET 2.0和ASP.NET 3.5应用程序)的Web.config文件。在IIS 7和IIS 7.5本机配置系统会扫描configSections元素时,它把配置文件的层次结构。移动从父Web应用程序的Web.config文件的根Web.config文件中的configSections定义有效地隐藏发生对孩子ASP.NET 4应用程序。在配置合并进程元素

Move the configSections definition in the Web.config file of the parent application (the application that runs ASP.NET 2.0 or ASP.NET 3.5) into the root Web.config file for the.NET Framework 2.0. The IIS 7 and IIS 7.5 native configuration system scans the configSections element when it merges the hierarchy of configuration files. Moving the configSections definition from the parent Web application’s Web.config file to the root Web.config file effectively hides the element from the configuration merge process that occurs for the child ASP.NET 4 application.

在32位操作系统或32位应用程序池,用于ASP.NET 2.0和ASP.NET 3.5的根Web.config文件通常位于以下文件夹:

On a 32-bit operating system or for 32-bit application pools, the root Web.config file for ASP.NET 2.0 and ASP.NET 3.5 is normally located in the following folder:

C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG

在64位操作系统或64位应用程序池,用于ASP.NET 2.0和ASP.NET 3.5的根Web.config文件通常位于以下文件夹:

On a 64-bit operating system or for 64-bit application pools, the root Web.config file for ASP.NET 2.0 and ASP.NET 3.5 is normally located in the following folder:

C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG

如果您在64位计算机上同时支持32位和64位的Web应用程序,您必须向上移动configSections元素融入根Web.config文件中同时为32位和64位系统。

If you run both 32-bit and 64-bit Web applications on a 64-bit computer, you must move the configSections element up into root Web.config files for both the 32-bit and the 64-bit systems.

当你把configSections元素根Web.config文件,粘贴节的配置元素之后。下面的例子显示了根Web.config文件的顶部应该是什么的时候,你已经完成了移动元素等。

When you put the configSections element in the root Web.config file, paste the section immediately after the configuration element. The following example shows what the top portion of the root Web.config file should look like when you have finished moving the elements.

请注意在下面的例子中,已换行是为了便于阅读。

Note In the following example, lines have been wrapped for readability.

<?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)。

This step is required whether the ASP.NET 4 child Web application is running on IIS 6 or on IIS 7 (or IIS 7.5).

在运行ASP.NET 2.0或ASP.NET 3.5父Web应用程序的Web.config文件中,添加位置标记明确指定(同时为IIS和AS​​P.NET配置系统)的配置项仅适用于父Web应用程序。下面的例子显示的位置元素的语法添加:

In the Web.config file of the parent Web application that is running ASP.NET 2 or ASP.NET 3.5, add a location tag that explicitly specifies (for both the IIS and ASP.NET configuration systems) that the configuration entries only apply to the parent Web application. The following example shows the syntax of the location element to add:

<location path="" inheritInChildApplications="false" >


下面的例子显示了位置标签是如何用来包裹开始appSettings部分和system.webServer节结尾的配置部分。

The following example shows how the location tag is used to wrap all configuration sections starting with the appSettings section and ending with system.webServer section.

<location path="" inheritInChildApplications="false" >


  
  
    
  
  
    
  
  
    

当您完成步骤1和2,儿童ASP.NET 4 Web应用程序将启动没有错误。

When you have completed steps 1 and 2, child ASP.NET 4 Web applications will start without errors.

这篇关于部署ASP.NET MVC 3在ASP.NET 3.5应用网站子文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆