I am trying create a web app container and have another asp.net core application under it . the tree structure is something like this on IIS.
Main Application (my.localhost.com/) Sub Application (my.localhost.com/subapp)
after Publishing the projects to IIS and viewing my.localhost.com in browser ever thing works fine but when i access my.localhost.com/subapp I get following error
Detailed Error Information:
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 'aspNetCore'
Config File \\?\C:\ASP.net solutions\Myproject\admin\web.config
when from the published web.config (which is auto generated by asp.net core) i remove following handler every thing seems to be working fine.
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
now i cant figure out a way to exclude this from web.config file. Any suggestions how this can be handled. Please help
As you wrote, you have to define the aspNetCore handler only in the root level web.config. In the sub applications you only define the application that uses the handler. This is problematic because publish automatically either generates or transforms the web.config with the handler specification.
For ASP.NET Core (and the new project file format) you can disable web.config transformations with <IsTransformWebConfigDisabled>False</IsTransformWebConfigDisabled>
. This of course means that you have to write the web.config by hand as it is not generated.
I had to add a new web.config (one did not exist) then uncomment the content in it
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- To customize the asp.net core module uncomment and edit the following section.
For more info see https://go.microsoft.com/fwlink/?linkid=838655 -->
<system.webServer>
<handlers>
<remove name="aspNetCore"/>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
User contributions licensed under CC BY-SA 3.0