2

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

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

5
  • 1
    That's how configuration works on IIS; each level inherits from the level above it. That should give you a hint about whether you really can do what you are trying to do... Commented Jan 16, 2012 at 12:18
  • Can you tell me how to deploy this application? Is I need to create a new website? Commented Jan 16, 2012 at 12:23
  • I have just found inheritInChildApplications. Checking this Commented Jan 16, 2012 at 12:33
  • This is the solution Commented Jan 16, 2012 at 13:00
  • Please post your solution as an answer and accept it. Commented Jan 27, 2012 at 21:02

1 Answer 1

1

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

Step 1 (IIS 7 or IIS 7.5 only)

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.

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.

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

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

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.

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>

Step 2 (all versions of IIS)

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

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

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

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.