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

标签 asp.net dnx50

我正在学习 Shawn Wildermuth 的类(class) 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>

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

最佳答案

直到当前写入时间(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">并将它放在它的正上方。

关于asp.net - 元素 'system.webServer' 具有无效的子元素 'httpPlatform',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34245066/

相关文章:

c# - asp.net web api 无法使用非管理员用户连接到 Azure SQL 数据库

c# - 在不使用按钮的情况下单击 gridview 行时不显示模式弹出窗口

asp.net-core - 系统.DllNotFoundException : Unable to load DLL 'libuv'

javascript - 如何解析 JSON 对象? (从服务器端到客户端...javascript)

asp.net - 多行文本框中的自动高度

mysql - 在 linux/osx 上使用 dnxcore 访问 mysql

mono - .NET Core,Mono和ASP.NET在非Windows平台上如何关联?

asp.net-core - 在功能、性能等方面为 Azure Web App 选择 dnx451 和 dnxcore 50

asp.net-mvc - 为什么 xUnit 找不到我的 DNX 测试?

c# - Visual Studio IIS HTTP 503 服务不可用