我从一个模板在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>
如何消除警告?
看起来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
你找到了解决这个问题的方法吗?我有同样的问题 –
@LuisPalacios,不幸的是,这个版本中存在已知的问题。请参阅此链接:https://github.com/aspnet/Tooling/blob/master/known-issues.md#missing-sdk – jp2code