We have ASP.NET Core 3.1 web app, and one of the appsettings.json
config sections has to have xml fragment as part of the section so it would look something like this. But settings up and running the app with the section like this resulted in exception. Tried number of things like replacing <
and >
with <
and >
but didn't help either. Hence the question - are xml fragments within appsettings.json
config allowed or we need to look at other options?
{
"Configuration": "<key id=\"1bbaebea-31f4-465f-b0a7-a19d64944388\" version=\"1\">
<value>zuX/fjZ35eRm4hgnFT2E3lQRPYF1IDJccboInH77Z 0DdMfZYVTg9 V5UkR0bK/DK1cXP6/ETn4/nlNrZOL62g==</value></key>"
}
Thank you!
CodePudding user response:
Please check Configuration providers in .NET
first.
As we know, appsettings.json
uses the JSON configuration provider
.
The method used to call example.xml belongs to the XML configuration provider.
So it is not recommended to put xml in appsettings.json file.