Asp.net-core – The element ‘system.webServer’ has invalid child element ‘aspNetCore’

asp.net-corevisual-studio-2015web.config

I created a new ASP.NET Core MVC 6 application from one of the templates in Visual Studio 2015.

The tutorial I'm looking at says to modify the web.config file. When I open that file, Visual Studio throws the warning:

Severity Code Description Project File Line Suppression State
Warning The element 'system.webServer' has invalid child element 'aspNetCore'. List of possible elements expected: 'asp, caching, cgi, defaultDocument, directoryBrowse, globalModules, handlers, httpCompression, webSocket, httpErrors, httpLogging, httpProtocol, httpRedirect, httpTracing, isapiFilters, modules, applicationInitialization, odbcLogging, security, serverRuntime, serverSideInclude, staticContent, tracing, urlCompression, validation, management, rewrite'.

Here is the virgin web.config file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>

  <!--
    Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
  -->

  <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>
</configuration>

How do I eliminate the warning?

Best Answer

Install .NET Core Tooling Preview 2 for Visual Studio 2015.

You can download it from the .NET Downloads page

If it's already installed and it doesn't work you can try doing a repair: Go to Programs and Features, select Microsoft .NET Core 1.0.1 - VS 2015 Tooling Preview 2, click change, and then repair.