Cannot add duplicate collection entry of type (0x800700b7)

From application slowness to 500 errors, we use Failed Request Tracing logs to get clues about the root cause of website related issues. However, the tracing itself may be subject of the troubleshooting efforts because of an error like “Cannot add duplicate collection entry of type (0x800700b7)”.

This the error message I saw for one of the applications after I enabled Failed Request Tracing in the IIS server:

Cannot add duplicate collection entry of type ‘add’ with unique key attribute ‘path’ set to ‘*’

Error code: 0x800700b7

Error "Cannot add duplicate collection entry of type (0x800700b7)"

Solution for the “Cannot add duplicate collection entry of type (0x800700b7)” error

The error message mentions a duplicate record so the first thing to try is checking the web.config for identical definitions:

  1. Enable Failed Request Tracing
  2. Add a rule
  3. If the issue occurs, check web.config file. Are there two sets of Failed Request Tracing rules even though you added only one?

If there are no duplicate entries, check the tracing module in all application, site, and server levels in IIS Manager. Make sure there are no conflicting rules. Do the same for applicationHost.config file. Make sure tracing for the same site is not enabled more than once.

After making sure there is only one rule, if the issue persists, add the line below into web.config. It will remove all existing rules to prevent duplication (Related forum post).

<remove path="*" />

The entire configuration of the Failed Request Tracing rule in the web.config:

<configuration>
    <system.webServer>
        <tracing>
            <traceFailedRequests>
                <remove path="*" />
                <add path="*">
                    <traceAreas>
                        <add provider="ASP" verbosity="Verbose" />
                        <add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" />
                        <add provider="ISAPI Extension" verbosity="Verbose" />
                        <add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,FastCGI,WebSocket" verbosity="Verbose" />
                    </traceAreas>
                    <failureDefinitions statusCodes="500" />
                </add>
            </traceFailedRequests>
        </tracing>
   
    </system.webServer>
</configuration>

A side note: In my case, the environment this issue occurred had two IIS servers pointing to the same web.config (located in a network share). This made it the issue more complicated.

There could be more than one root causes of the 0x800700b7 error. If the issue is still occurring after the config change above, check this post out: Creating an instance of the COM component with CLSID failed (800700b7)

Leave a Comment