The answer above didn’t work for me, however DavidG’s comment did solve my problem, so going to post as an answer in case it helps someone else.
For me, I was not running it as a sub-application, and a project that had been working for me no issue for over a year suddenly stopped working with this issue. Still not sure what changed. When I commented out or removed the <add name="aspNetCore".../>
the error persisted, and then that line got automatically re-added.
To solve the problem, I added <remove name="aspNetCore" />
to the config file, right above the <add name="aspNetCore"... />
entry, and things started working again.