So, I\'m reading through all of the .NET Core Fundamentals articles on MSDN while hacking around on a new .NET Core MVC application in Visual Studio 2017. There seem to be some
Bloog, you have probably already found your answers by now - but I wanted to comment here just in case and for anyone else looking into this.
web.config from what I understood was no longer part of a ASP.net Core web application either. And, like you said, when creating new ASP.net Core Web Application projects - there is no web.config file in my projects either. But, when I Publish me apps to my IIS based web host - there is a web.config file in the root of the web app folder on the host system.
After much research, it seems to me that this is not a 'web.config' file in the same sense - it is being used as a configuration file for the environment 'wrapper' that the kestrel server is running in. I have found multiple explanations to configure database connection strings in the < aspNetCore > section of this file under the < system.webserver > section. I was also using IIS Manager for Remote Administration to configure IIS settings on my hosting service. One setting, in particular, was to us IP Restrictions to stop users from anywhere but my IP from accessing my test site. I would configure this and then test it and it was working great, but then when I would make some changes and re-Publish my site - this setting would go back to an unconfigured state.
Well, I reconfigured it again and then went to set up some DB connection strings in the web.config file, but I opened it, I saw that there was a section added to the web.config file with my IIS IP Restriction settings there as well! HMMM!
So, I re-published the site again and then re-checked the web.config file again... no IP Restriction settings! So IIS configurations were directly modifying this web.config file. Again, I re-configured my IP Restrictions, then copied this web.config file and added it to my Visual Studio project. Now when I re-Publish - this file is Published as well and its keeping my IP Restrictions in place.
When you look at the structure of this web.config file, it seems like the only thing in it is related to the IIS environment, so I think it is in effect acting like an IIS config files and helping to create almost a simple virtual server environment for the kestrel server to run in. In my case, I am hosting on a shared hosting server, so I cannot access my own environment variables where everyone suggests putting DB connection strings for Core projects - but this web.config file seems to be taking these environment variables and IIS settings and applying them to the wrapper that kestrel is running in.
I can't say what all it can do - especially in comparison to its original function in ASP.NET projects - but I think - it seems to have nearly nothing in common to do with it. It would suit me fine if they would call it environment.config or server.config or... This has been very confusing conflating the two iterations of this web.config file like this.
I am still testing with this - but it is affecting IIS Express from Visual Studio. Currently, I'm getting "Unable to start process C:\Program Files\dotnet\dotnet.exe. The web server request failed with status code 500, Internal Server Error. The full response has been written to C:\Users\mywindowsuseracct\AppDate\Local\Temp\HTTPFailure_12-52-15.html" when I start my project - but, If I simply change the name of the web.config file in the VS project, then it runs fine. I'd say it's because this web.config is telling IIS where to run the aspNetCore project dll and it is currently based on the location of the file on the host server vs VS IIS Express.
So I think the next step will be trying to see how to only publish this file in Release mode when published to the host - and to be ignored when running in IIS Express in Dev mode.
Hope this helps!