Why do we need web.config in ASP.NET 5 wwwroot?

In ASP.NET 5, the configuration changes dramatically. We no longer have the web.config . Instead, we can use JSON and other parameters, depending on how we set things up in our Startup class. Unlike web.config , this configuration is usually not part of wwwroot , and there is no danger that clients will be able to access it.

And yet in the ASP.NET 5 project templates there is a web.config 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 may be what the hosting server is looking at runtime, regardless of the configuration of the application.

Can someone shed some light on why this is necessary and how it works?

+7
web-config asp.net-core
source share
2 answers

Web.config is strictly intended for IIS configuration. This is not necessary if hosting is in IIS. It is not used when starting the application from the command line.

In the past, Web.config has been 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 used only for IIS configuration.

This decoupling of the application from IIS is part of what makes cross-platform possible.

+14
source share

I was interested in the same thing, I know that Joe Audett already answered the question, but after a little research I found this article that others may find useful: http://shazwazza.com/post/aspnet-5-re-learning -a-few-things-part-1 /

"If you use IIS, there may still be a web.config file that you can use to configure IIS settings in the system.webserver section."

+1
source share

All Articles