In ASP .NET 5, Configuration is changing drastically. We no longer have a web.config
file. Instead, we can use JSON and other options, depending on how we set things up in our Startup
class. Unlike web.config
, such configuration typically doesn't go in wwwroot
, and there is no danger that clients can gain access to it.
And yet, in the ASP .NET 5 project templates there's a web.config
file in wwwroot
with the following contents:
<?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>
It seems to me that this could be something that the hosting server is looking for at runtime, independently of the application configuration.
Can anyone shed some light on why this is needed, and how it works?
Web.config is strictly for IIS Configuration. It is not needed unless hosting in IIS. It is not used when you run the app from the command line.
In the past Web.config was used for both IIS configuration and application configuration and settings. But in asp.net 5 it is not used by the application at all, it is only used for IIS configuration.
This decoupling of the application from IIS is part of what makes cross platform possible.