Add entries to web.config file of asp.net core application when web.config does not exist

我的梦境 提交于 2020-06-01 05:17:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!