By default when you add a web.config file to an ASP.NET Core application, the config file is transformed with the correct processPath and arguments.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<!-- To customize the asp.net core module uncomment and edit the following section. | |
For more info see https://go.microsoft.com/fwlink/?linkid=838655 --> | |
<system.webServer> | |
<handlers> | |
<remove name="aspNetCore"/> | |
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/> | |
</handlers> | |
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" /> | |
</system.webServer> | |
</configuration> |
This can be quite annoying especially if you want to apply some web config transformation magic.
Inside the documentation, I found that you can prevent the Web SDK from transforming the web.config file by setting the <IsTransformWebConfigDisabled> property in the project file:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<PropertyGroup> | |
<IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled> | |
</PropertyGroup> |
This disabled the web config transformation behavior but didnāt solve the problem that Visual Studio updated the web.config file.
A colleague sent me another (undocumented?) flag <ANCMPreConfiguredForIIS> :
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<PropertyGroup> | |
<ANCMPreConfiguredForIIS>true</ANCMPreConfiguredForIIS> | |
</PropertyGroup> |
Remark: This setting only works when you are running in IIS InProcess.