Ktash Ktash - 3 months ago 127
ASP.NET (C#) Question

IIS Express launched from VS 2015 cannot read config file with <aspNetCore> element

I'm trying to get an ASP.Net project set up to run in Visual Studio 2015 from existing code (originally created in VS Code and run from command line).

In my web.config file, I have the following block:

<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
</system.webServer>


Visual Studio 2015 (with Update 3) gives the
<aspNetCore>
element a squiggly underline and says that element can't be a child element of
<handlers>
. When I launch the site, I get the following error.


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

Detailed Error Information: Module IIS Web Core Notification

Unknown Handler Not yet determined Error Code 0x8007000d Config
Error Config File

\?\C:\Users\ktsashes\Projects\aspnet-proj\web.config


If I remove that line, IIS Express complains with the error "Handler "aspNetCore" has a bad module "AspNetCoreModule" in its module list". If I remove the whole block, it does not go through ASP.Net and tries to list the directory (which is forbidden by the security rules).

Most trouble-shooting steps say I should install the URL Rewrite module, but that is for IIS and I have read that it doesn't work for IIS Express. But I attempted to install it anyway to no luck.

My logs at Documents/IISExpress/Logs don't seem to have any useful information. How can I further troubleshoot or remedy this issue?

Answer

My issue was that I did not have a reference to ".NETCoreApp" to my project. I was also unable to add it to the project I created using the files. The only was I was able to get it to work was by creating a new project and copying all the files over. Which became a bit of a process with the git mv's, but all appears to be working now. So double-check that you have a ".NETCoreApp" reference in your project.

Comments