IIS Web Deploy Website Error: HTTP error 500.19 – Internal Server Error

HTTP error 500.19-Internal Server Error
The requested page cannot be accessed because the relevant configuration data for the page is invalid.

Detailed error information:

Module: IIS Web Core
Notice: BeginRequest
error code: 0x800700b7
Configuration error: When the unique key attribute “name” is set to “ScriptHandlerFactory”, duplicate collection items of type “add” cannot be added
Because the child site inherits the web.config of the parent site

Because the child site inherits the web.config of the parent site

  <location path="." allowOverride="true" inheritInChildApplications="false">
  /* Wrap <system.web> with location in the web.config file
    </system.web>
*/
// If it doesn't work, wrap all configurations with the <add> attribute in location
 
  </location>

For example: system.web, system.webServer, ApplicationConfiguration and other configuration
locations with add attributes only need to be written once

Make the subsite not inherit the web.config of the parent site

Read More: