2016-06-21 48 views
16

我从一个模板在Visual Studio中创建一个新的ASP.NET MVC的核心应用6 2015年元素“system.webServer具有无效子元素“aspNetCore”

我看教程说修改web.config文件。当我打开该文件时,Visual Studio将引发警告:

严重性代码说明项目文件的线路抑制状态
警告元素“system.webServer具有无效子元素“aspNetCore”。预期的可能元素列表:'asp,caching,cgi,defaultDocument,directoryBrowse,globalModules,处理程序,httpCompression,webSocket,httpErrors,httpLogging,httpProtocol,httpRedirect,httpTracing,isapiFilters,模块,applicationInitialization,odbcLogging,安全性,serverRuntime,serverSideInclude,staticContent ,跟踪,urlCompression,验证,管理,重写'。

这里是处女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> 

如何消除警告?

+2

看起来web.config的模式不是最新的 - 您安装了preview1工具吗?另外,您不需要手动更改web.config。相反,您应该将publish-iis脚本配置为postpublish脚本,这会在您发布应用程序时为您调整配置。如果你想了解更多的细节,请查看我关于使用IIS运行ASP.Net Core应用的文章 - https://blog.3d-logic.com/2016/06/08/running-asp-net-core-applications-with-iis- and-antares/ – Pawel

+0

你找到了解决这个问题的方法吗?我有同样的问题 –

+0

@LuisPalacios,不幸的是,这个版本中存在已知的问题。请参阅此链接:https://github.com/aspnet/Tooling/blob/master/known-issues.md#missing-sdk – jp2code

回答

3

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

如果已安装,您可以从the .NET Downloads page

下载它,它不工作,你可以尝试做一个修复:去程序和功能,选择微软.NET核心1.0.1 - VS 2015模具预览2,点击变更,然后修复

+0

这没有帮助。每次构建应用程序时,Visual Studio都会通过web.config将其更改为读取参数=%LAUNCHER_ARGS%。直到我将参数更改回我的应用程序dll的名称,aspNetCore elemnt才有效。然后标签再次失效。我修复了三次工具安装。 – pthalacker

+0

@pthalacker - 对不起。当我修好我的时候,我认为它适合我。不幸的是,我不能删除我的答案,因为它已被接受。 –

1

同样的问题在这里,我解决了运行VS2016“作为管理员”。右键单击VS2016可执行文件,点击“运行管理员”,然后加载项目

1

同样的问题在这里VS 2015.我刚刚安装VS 2017社区,并为我解决了它。

相关问题