The element 'system.webServer' has invalid child element 'aspNetCore'

10,313

Solution 1

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.

Solution 2

Same problem here in VS 2015. I just installed VS 2017 community, and that solved it for me.

Solution 3

Same problem here, I solved running VS2016 "as administrator". Right click on the VS2016 executable, click on "Run an Administrator" then load the project

Share:
10,313

Related videos on Youtube

jp2code
Author by

jp2code

Software Developer @ IPKeys and jp2code.net Long ago, I left home and joined the United States Marine Corps where I was assigned the Military Occupational Specialty (MOS) of Basic Metal Worker (MOS 1316). I loved building things as a welder, but could not see myself doing this until I reached age 65. After my Honorable Discharge in the early 1990s, I used my G.I. Bill to go to school and received my Bachelor of Science Degree in Physics four years later. Using a love of computers since I played on a Commodore 64 at 10 years old and two (2) C++ electives that I had taken in school, I began working in the computer programming field. The recession following ENRON in 2001 left me working at a remedial job for a little over two years while I brushed up on my skills at a local community college in SQL and first learned what the new .NET Framework was all about. I have had the pleasure of working as a Software Developer since 2003. For a short while, I pulled in a little extra income by running a moonlighting business under the name Joe's Welding. Dangerous working conditions and non-paying customers prompted me to sell my mobile welding equipment about the time my son was born. Today, I am exclusively a Software Developer. My language of choice is C#, and I enjoy working with databases. If you care to find me anywhere else, just do a search on my screen name: jp2code

Updated on September 16, 2022

Comments

  • jp2code
    jp2code over 1 year

    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?

    • Pawel
      Pawel almost 8 years
      Looks like the schema for web.config is not up-to-date - have you installed preview1 tooling? Also, you should not need to change web.config manually. Rather you should have the publish-iis script configured as a postpublish script which will tweak the config for you when you publish your application. If you want more details check my post about running ASP.Net Core apps with IIS - blog.3d-logic.com/2016/06/08/…
    • Luis Palacios
      Luis Palacios over 7 years
      did you find a way to solve this? i am having the same problem
    • jp2code
      jp2code over 7 years
      @LuisPalacios, unfortunately, there are known issues in this release. See this link: github.com/aspnet/Tooling/blob/master/…
    • jp2code
      jp2code over 7 years
      Try updating Visual Studio 2015: microsoft.com/net/core#windows
    • Francesco Bonizzi
      Francesco Bonizzi over 7 years
      To me opening Visual Studio as Administrator didn't solve the "warning underscore", but made the process start on IIS Express.
  • pthalacker
    pthalacker over 7 years
    This doesn't help. Every time I build the application Visual Studio oversrites web.config to change it to read arguments = %LAUNCHER_ARGS%. The aspNetCore elemnt is valid until I change arguments back to the name of my application dll. Then the tag becomes invalid again. I have repaired the tools installation 3 times.
  • Stephen Oberauer
    Stephen Oberauer over 7 years
    @pthalacker - Sorry about that. I thought that it worked for me when I repaired mine. Unfortunately I cannot delete my answer, because it has been accepted.