Why Visual Studio 2017 resets .NET Core web.config file while running

Viewed 412

I have been experiencing this weird issue since i have reinstalled my Visual Studio 2017 Enterprise. I have a .NET core application with this following web.confg file.

 <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="true" />

As you notice, it uses the pass-through authentication. But whenever I run the application through the IDE, it simply overwrites the above line and resets the forwardWindowsAuthToken to false. Which in turns, failed to work in the browser and gives 401 - Unauthorised error. I have reinstalled the VS, reset the settings and even cleared my code repository many times but still no luck.

Any help would be greatly appreciated.

1 Answers

The reason is, you have configured launching project using IIS Express. The web.config file values are required to run it properly. To change the values to use regular IIS, go to project properties and in the Debug tab select Launch: IIS, instead of IIS Express. This will still overwrite your values, but at least IIS integration will work.

ASP.NET Core 2 Debug Tab

You can safely ignore web.config values when you use .NET Core self-hosting, using .exe file, as the web.config is ignored when you self-launch the app that way.

Related