Problem with Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'ScriptHandlerFactory'  [Answered]RSS

4 replies

Last post Dec 05, 2013 01:37 AM by n4th4nr1ch

  • Problem with Cannot add duplicate collection entry of type 'add' with unique key attribute 'name'...

    Jun 30, 2009 12:47 AM|arifliminto86|LINK

    Hi, my name is Arif,

    I've tried to deploy the website in windows server 2008 (IIS 7.0). However, it does not work successfully. I developed the website using windows xp and I also have tried to published in windows xp and it works great.

    For that projects, I use AJAX. in windows server 2008(IIS 7.0) I am sure that I have installed ajax extension which is the same version that i have installed in my local machine ( windows xp).

    Here is the error details that I've got, any idea how to solve this error?

    <div class="content-container">

    HTTP Error 500.19 - Internal Server Error

    The requested page cannot be accessed because the related configuration data for the page is invalid.

    </div> <div class="content-container">
    Detailed Error Information <div id="details-left">
    Module IIS Web Core
    Notification BeginRequest
    Handler Not yet determined
    Error Code 0x800700b7
    Config Error Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'ScriptHandlerFactory'
    Config File \\?\C:\inetpub\wwwroot\arif\arif\web.config
    </div> <div id="details-right">
    Requested URL http://localhost:80/arif/arif/index.htm
    Physical Path C:\inetpub\wwwroot\arif\arif\index.htm
    Logon Method Not yet determined
    Logon User Not yet determined
    </div>
    </div> <div class="config_source content-container">
    Config Source
      142:         
    143: <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
    144: type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </div>

    IIS7 web.config scripthandlerfactory http error 500.19 iis 7.0

  • Re: Problem with Cannot add duplicate collection entry of type 'add' with unique key attribute 'n...

    Jul 03, 2009 03:42 AM|Leo Tang - MSFT|LINK

    Hi,

    As the error message indicates , there are duplicate collection entry. You can try add the following section at the beginning of the handler section:
    <remove name="ScriptHandlerFactory">

    The website will inherits the settings form parent level . This should be the reason of this issue. You can check if there is a web.fig file in the parent web content folder(e.g. C:\inetpub\wwwroot\arif\ or C:\inetpub\wwwroot ) and an duplicate collection entry in it.

    Please mark the replies as answers if they help or unmark if not.
    Feedback to us


  • Re: Problem with Cannot add duplicate collection entry of type 'add' with unique key attribute 'n...

    Mar 18, 2013 12:57 PM|wantnewdesk|LINK

    I have a similar problem today. Solution from Microsoft is http://support.microsoft.com/kb/942055. Which seems reasonable, except that doesn't apply  to my problem as my website is already top level, no chance such duplicate name appears in applicationHost.config.

    Then I found the cause. In my IIS 7, say default directory is c:\mywebsite\ for physical path. And then inside that I added an application, say UI with the same physical path (Don't ask why, I just inherit this).

    So the application will be called as http://localhost/UI to display what in c:\mywebsite.

    Then I started to have error complaining duplicate httpModule which is impossible to be duplicate as it is customised.

    <httpModules>
                <add name="SecurityModule" type="blabla, bla" />

    Figure out that's because I set Application Pool on the top level differently with that on UI application level. Top level is Classic .NET AppPool, the other is DefaultAppPool.

    Careless!

  • Re: Problem with Cannot add duplicate collection entry of type 'add' with unique key attribute 'n...

    Mar 21, 2013 11:32 AM|FrustratedATX|LINK

    wantnewdesk

    I have a similar problem today. Solution from Microsoft is http://support.microsoft.com/kb/942055. Which seems reasonable, except that doesn't apply  to my problem as my website is already top level, no chance such duplicate name appears in applicationHost.config.

    Then I found the cause. In my IIS 7, say default directory is c:\mywebsite\ for physical path. And then inside that I added an application, say UI with the same physical path (Don't ask why, I just inherit this).

    So the application will be called as http://localhost/UI to display what in c:\mywebsite.

    Then I started to have error complaining duplicate httpModule which is impossible to be duplicate as it is customised.

    <httpModules>
                <add name="SecurityModule" type="blabla, bla" />

    Figure out that's because I set Application Pool on the top level differently with that on UI application level. Top level is Classic .NET AppPool, the other is DefaultAppPool.

    Careless!

    I have absolutely no idea what this means. Can someone translate please?

  • Re: Problem with Cannot add duplicate collection entry of type 'add' with unique key attribute 'n...

    Dec 05, 2013 01:37 AM|n4th4nr1ch|LINK

    FrustratedATX

    I have absolutely no idea what this means. Can someone translate please?

    He's saying that the directory set for the website was the same as that set for the application.

    Check basic settings for the website instance and the same for the application.