This article is contributed. See the original author and article here.

Here is the error message displayed 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 ‘*’


Nedim_0-1604542465384.jpeg


 


 


Solution


Since the error message mentions a duplicate record, check 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 identical Failed Request Tracing rules?


 


If there are no duplicates, check the rules in tracing module at all application, site, and server levels in IIS Manager. Make sure there are no conflicting rules.


 


If the issue still persists, add the line below into web.config. It will remove all existing rules to prevent duplication.


 

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

 


Note: In my case, the environment this issue occurred had two IIS servers pointing to the same web.config (located in a network share).

Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.

%d bloggers like this: