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?
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.
A web. config file is a Windows file that lets you customize the way your site or a specific directory on your site behaves. For example, if you place a web. config file in your root directory, it will affect your entire site (www.coolexample.com).
In order to set up the ASP.NET Core Module correctly, the web. config file must be present at the content root path (typically the app base path) of the deployed app.
Yes, we can run an Asp.Net web application without web. config file but without in debugging mode. If we don't configure any settings in web. config file then it consider machine.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With