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

11,205

Solution 1

Restarting visual studio might help on this.

This usually happens when you have invalid configs in your {solutions_dir}/.vs/{project_name}/config/applicationhost.config. This file contains machine specific configuration.

.vs/* directory should be added to your gitignore if you are using git. So the contents of this directory never gets pushed to the main repo.

If this will not work.

  • Open the file {solutions_dir}/.vs/{project_name}/config/applicationhost.config.
  • Go to the sites section
  • Check the application if it matches the physical path that is configured for each site applications. IISExpress will look use the phyiscalPath as its based directory per application.

Solution 2

In my case Actual issue was directory, to solve it what i did was creating same folder directory (as in my system) into other system.

IIS was trying to find webconfig in D:\Visualstudio Projects\SPARC\SPARC\

So, i created folder "Visualstudio Projects" in D: and then pasted the project there and it worked..

There was no any problem in web.config or applicationhost.config or in any of the IIS configuration.

Solution 3

I have this issue when I have same project file (Solution file) in two separate folder. The project properties was same and port number for IIS Express was same. The issue is resolved when I created new virtual directory.

Change project URL in Project>Properties>Web>Servers>Project Url.

Please create new Virtual Directory.

Share:
11,205
Osama Bin Waseem
Author by

Osama Bin Waseem

Updated on June 04, 2022

Comments

  • Osama Bin Waseem
    Osama Bin Waseem almost 2 years

    I am developing a project using vstudio 2015, when i tried to run it on another system i am getting following error, tried many solutions available here but unable to get rid of this.

    Note: another systems has same configurations as of mine.

    HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid. Detailed Error Information: Module IIS Web Core Notification Unknown Handler Not yet determined Error Code 0x80070003 Config Error Cannot read configuration file Config File \?\D:\Visualstudio Projects\SPARC\SPARC\web.config Requested URL http://localhost:1396/ Physical Path
    Logon Method Not yet determined Logon User Not yet determined Request Tracing Directory C:\Users\Syeds\Documents\IISExpress\TraceLogFiles\ Config Source:

    -1: 0:

    More Information: This error occurs when there is a problem reading the configuration file for the Web server or Web application. In some cases, the event logs may contain more information about what caused this error.

    If you see the text "There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined", this error is because you are running a .NET Framework 3.5-based application in .NET Framework 4. If you are running WebMatrix, to resolve this problem, go to the Settings node to set the .NET Framework version to ".NET 2". You can also remove the extra sections from the web.config file.

    Warm welcome for suggestion and answers, Thanks & Regards.

  • Osama Bin Waseem
    Osama Bin Waseem over 8 years
    no there's no any scriptResourceHandler in my whole solution.
  • User2012384
    User2012384 over 8 years
    In that case, can you post your web.config and let us have a look?
  • Osama Bin Waseem
    Osama Bin Waseem over 8 years
    i solved it, u can read my answer... Many thanks for your time :)
  • StingyJack
    StingyJack over 8 years
    Keep in mind that web.config (like machine.config) files will merge. So if you have a web.config in the root, and a web.config in a subfolder, your application will read machine.config -> root web.config -> subfolder web.config. This may be causing the "duplicate" error.
  • Osama Bin Waseem
    Osama Bin Waseem over 8 years
    Yes you are right, but in my case problem solved when i created right directory where iis was trying to find web.config. In real there was no issue of duplication but i don't know why error message was telling it as issue of duplication or .Net framework version. From here i got clue: Cannot read configuration file Config File \?\D:\Visualstudio Projects\SPARC\SPARC\web.config
  • Manoj Sethi
    Manoj Sethi almost 5 years
    Solved for me. Thanks