我正在处理Shawn Wildermuth的课程here并在构建时收到有关web.config的以下警告
Severity Code Description Project File
Line
Warning The element 'system.webServer' has invalid child element 'httpPlatform'.
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'.
TheWorld E:\EShared\Pluralsight\aspdotnet-5-ef7-bootstrap-angular-web-app\1-aspdotnet-5-ef7-bootstrap-angular-web-app-m1-exercise-files\VS2015\src\TheWorld\wwwroot\web.config 8
Web.config是
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
</handlers>
<httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false" startupTimeLimit="3600"/>
</system.webServer>
</configuration>
程序运行正常。我应该对警告做些什么吗?
答案 0 :(得分:7)
直到写入当前时间(2016年1月),这是MS未解决的已知问题。它可能会在以后的版本/更新中修复。
问题是缺少httpPlatform元素:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Xml\Schemas\1033\DotNetConfig.xsd
您可以使用具有管理员权限的编辑器手动修改xsd,并在system.webServer下添加:
<xs:element name="httpPlatform" vs:help="configuration/system.webServer/httpPlatform">
<xs:complexType>
<xs:attribute name="arguments" type="xs:string" use="optional" vs:help="configuration/system.webServer/httpPlatform/arguments" />
<xs:attribute name="processPath" type="xs:string" use="required" vs:help="configuration/system.webServer/httpPlatform/processPath" />
<xs:attribute name="startupTimeLimit" use="required" vs:help="configuration/system.webServer/httpPlatform/startupTimeLimit">
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:minInclusive value="1" />
<xs:maxInclusive value="99999" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="stdoutLogEnabled" type="small_boolean_Type" use="required" vs:help="configuration/system.webServer/httpPlatform/stdoutLogEnabled" />
<xs:attribute name="stdoutLogFile" type="xs:string" vs:help="configuration/system.webServer/httpPlatform/stdoutLogFile" />
<xs:anyAttribute namespace="http://schemas.microsoft.com/XML-Document-Transform" processContents="strict" />
</xs:complexType>
</xs:element>
这解决了我的问题。
更新:您可以找到类似的帖子here。我在那里得到了最初的想法,但稍微修改了架构。
UPDATE2:一个提示,找到添加元素的地点就是定位
<xs:element name="handlers" vs:help="configuration/system.webServer/handlers">
把它放在它上面。
答案 1 :(得分:1)
首先,这门课程现在相当陈旧(RC2即将到来),所以你必须放弃它,等着看是否有更新的课程。
[更新:对于RC2及更高版本,需要新模块而不是HttpPlatformHandler,https://github.com/aspnet/Announcements/issues/164]