Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'WebServiceHandlerFactory-ISAPI-4.0_64bit'

0

I have a Internet Information Services installed on a Windows Server 2019.

In the IIS I have hosted a svc service, but when i browse the service i'm getting the error below:

Module IIS Web Core

Error Code 0x800700b7

Config Error Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'WebServiceHandlerFactory-ISAPI-4.0_64bit'

But when i remove these 4 handler line from the web.config, the service works fine:

    <handlers>
        <add name="WebServiceHandlerFactory-ISAPI-4.0_64bit" path="*.asmx" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
        <add name="svc-ISAPI-4.0_64bit" path="*.svc" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
    </handlers>

I have also another environment with the same setup, but here the service works fine without removing the handler lines from the web.config.

Can anyone explain to me what the handler line does and why I need them, also why i need to remove them in one environment but not in another environment.

thanks

asp.net
iis
iis-7.5
iis-8
asked on Stack Overflow May 11, 2021 by Bala

1 Answer

0

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="*" />
answered on Stack Overflow May 18, 2021 by samwu

User contributions licensed under CC BY-SA 3.0