Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The element 'system.webServer' has invalid child element 'httpPlatform'

Tags:

asp.net

dnx50

I am working through Shawn Wildermuth's course here and get the following warning about web.config when I build

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 is

<?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>

The program runs ok. Should I be doing anything about the warning?

like image 516
Kirsten Avatar asked Dec 12 '15 21:12

Kirsten


Video Answer


1 Answers

Up until the time the current is written (Jan-2016) this is a known issue that MS did not fix. It will probably be fixed in a later version/update.

The problem is that the httpPlatform element is missing from:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Xml\Schemas\1033\DotNetConfig.xsd

You can manualy modify the xsd with an editor having Administrator right and add this under the 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>

This solved the problem for me.

UPDATE: you can find a similar post here. I got the original idea there, but modified the schema a bit.

UPDATE2: a hint to find the spot to add the element is to locate <xs:element name="handlers" vs:help="configuration/system.webServer/handlers"> and place it just above it.

like image 108
cnom Avatar answered Sep 29 '22 11:09

cnom