元素'system.webServer'具有无效的子元素'httpPlatform'

Kir*_*eed 7 asp.net dnx50

我正在浏览Shawn Wildermuth的课程,并在构建时收到有关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
Run Code Online (Sandbox Code Playgroud)

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>
Run Code Online (Sandbox Code Playgroud)

程序运行正常.我应该对警告做些什么吗?

cno*_*nom 7

直到写入电流的时间(2016年1月),这是MS未解决的已知问题.它可能会在更高版本/更新中修复.

问题是httpPlatform元素缺少:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Xml\Schemas\1033\DotNetConfig.xsd
Run Code Online (Sandbox Code Playgroud)

您可以使用具有管理员权限的编辑器手动修改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>
Run Code Online (Sandbox Code Playgroud)

这解决了我的问题.

更新:你可以在这里找到类似的帖子.我在那里得到了最初的想法,但稍微修改了架构.

UPDATE2:找到添加元素的位置的提示是找到 <xs:element name="handlers" vs:help="configuration/system.webServer/handlers"> 它并将其放置在它上面.


Lex*_* Li 1

首先,该课程现在已经相当旧了(RC2 即将推出),因此您必须放弃它,并等待看看是否会推出新课程。

[更新:对于 RC2 及更高版本,需要一个新模块而不是 HttpPlatformHandler,https://github.com/aspnet/Announcements/issues/164]