7

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?

Kirsten
  • 15,730
  • 41
  • 179
  • 318
  • This is a [known issue](https://connect.microsoft.com/VisualStudio/Feedback/Details/1906736) and if it's not a show stopper I'd ignore it. – ourmandave Dec 12 '15 at 21:56

2 Answers2

7

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.

cnom
  • 3,071
  • 4
  • 30
  • 60
  • 1
    Add it above this line – Dživo Jelić Feb 14 '16 at 03:00
  • 1
    Dzivo, it does not have to be exactly above element:handlers, as long as it is inside element:system.webServer! But, OK it is a good suggestion, to help find the spot! I update the answer now.. Please upvote if it worked for you ;-) – cnom Feb 15 '16 at 10:58
  • Doesnt have to be but it is easier for someone who doesnt know where to put it – Dživo Jelić Mar 17 '16 at 17:15
1

First, that course is rather old now (RC2 is coming), so you would have to give it up, and wait to see if a newer course is coming.

[Updated: For RC2 and above, a new module is required instead of HttpPlatformHandler, https://github.com/aspnet/Announcements/issues/164]

Lex Li
  • 60,503
  • 9
  • 116
  • 147
  • I downloaded HttpPlatformHandler_1.exe but when I run it the Web Platform Installer 5.0 gives a message that "Microsoft Web Platform Installer couldn't find the product you tried to install. Either the link you clicked is incorrect or you may be overriding your feed with a different feed" – Kirsten Dec 13 '15 at 00:48
  • The MSI download links are at the bottom, https://www.iis.net/downloads/microsoft/httpplatformhandler – Lex Li Dec 13 '15 at 01:26
  • @kirsteng Are you in Windows Vista? – Lex Li Dec 13 '15 at 10:29
  • 1
    @kirsteng updated the answer, and everything has changed since December. – Lex Li Mar 26 '16 at 05:53
  • Thanks @Lex-Li, although it will be a while before I can get to try it. – Kirsten Mar 26 '16 at 06:16
  • 1
    @kirsteng if you are lucky enough to wait till its RTM day, then you will see the whole image with all necessary information. Currently it is really not the best time to jump onto it :) – Lex Li Mar 26 '16 at 11:34