7

我正在学习 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

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>

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

4

2 回答 2

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>

这为我解决了这个问题。

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

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

于 2016-01-28T13:44:18.057 回答
1

首先,该课程现在已经相当老了(RC2 即将到来),所以您必须放弃它,并等待看是否有新课程即将推出。

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

于 2015-12-13T00:22:24.737 回答