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

1

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?

asp.net
visual-studio-2015
web-config
iis-express
asked on Stack Overflow Aug 25, 2016 by LoveAndCoding

2 Answers

1

Maybe its stupid question, but have you tried installing .NET Core 1.0.0 - VS 2015 Tooling Preview 2 https://www.microsoft.com/net/core#windows?

If so maybe try to repair it:

  1. Go to Programs and Features
  2. Select Microsoft .NET Core 1.0.0 - VS 2015 Tooling Preview 2
  3. Click change
  4. Choose repair
answered on Stack Overflow Aug 29, 2016 by Lesmian
0

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.

answered on Stack Overflow Aug 30, 2016 by LoveAndCoding

User contributions licensed under CC BY-SA 3.0