元素' system.webServer'有无效的子元素Â aspNetCore'

时间:2016-06-21 13:15:38

标签: visual-studio-2015 web-config asp.net-core

我从Visual Studio 2015中的一个模板创建了一个新的ASP.NET Core MVC 6应用程序。

我正在看的教程说要修改web.config文件。当我打开该文件时,Visual Studio会发出警告:

  

严重级代码说明项目文件行抑制状态
  警告元素' system.webServer'具有无效的子元素Â aspNetCore'。预期可能元素列表:' asp,caching,cgi,defaultDocument,directoryBrowse,globalModules,处理程序,httpCompression,webSocket,httpErrors,httpLogging,httpProtocol,httpRedirect,httpTracing,isapiFilters,modules,applicationInitialization,odbcLogging,security,serverRuntime, serverSideInclude,staticContent,tracing,urlCompression,validation,management,rewrite'。

这是处女web.config文件:

<?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>

如何消除警告?

3 个答案:

答案 0 :(得分:3)

安装.NET Core Tooling Preview 2 for Visual Studio 2015

您可以从the .NET Downloads page

下载

如果它已经安装且不起作用,您可以尝试进行修复:转到程序和功能,选择 Microsoft .NET Core 1.0.1 - VS 2015 Tooling Preview 2 ,单击更改,然后修复

答案 1 :(得分:1)

同样的问题,我解决了以管理员身份运行VS2016的问题。右键单击VS2016可执行文件,单击“运行管理员”,然后加载项目

答案 2 :(得分:1)

VS 2015中的问题相同。我刚刚安装了VS 2017社区,这为我解决了这个问题。

相关问题