问题
I have an asp.net CORE project targeting .NET Framework 4.71
There is an appsettings.json file but not web.config.
When I check the binaries of the deployed application service, then I see there is
a file literally called web.config.
I need to put some server header removal entries in that web.config but it seems
only to be available where it is deployed.
So who is creating that web.config file which is not available locally in the
code solution?
回答1:
In regular .NET world, we have option to save settings in web.config or in app.config file. But in .NET Core, you have option to save them in few other locations like appsettings.json
, appsettings.<Environment>.json
and in secrets.json
.
One of the main reason settings are not saved in web.config file is, to avoid settings getting checked-into repo. By default appsettings.json
file are ignored by repo clients.
As Kirk said, the dotnet-cli automatically creates this web.config
based on the the csproj settings.
来源:https://stackoverflow.com/questions/57982661/add-entries-to-web-config-file-of-asp-net-core-application-when-web-config-does