Reputation: 11
Hi i've a problem with botframework v3 (.Net 4.6), i need to transfer the part applicationsetting present in the web.config into a new file applicationsettings.json. I use a singleton object on the Global.asax for take all the settings from this json file, and it works. I see a problem when i debug my bot because it go in exception when i call the PostAsync. Before some test i understand the problem, the bot search in my web.config MicrosoftAppId and the MicrosoftAppPassword but i have this values into the new file. My questio is:
There's the possibility to change the bot settings from the web.config into a new json file completly?
Thanks for all!
Upvotes: 1
Views: 59
Reputation: 73253
I believe the variables need to be in AppSettings for Autofac to find them.
You can though add them in after reading them from your Json file: we do this in the controller constructor (we have different config sections for different bots)
AddConfigurationSetting("MicrosoftAppId", appId);
AddConfigurationSetting("MicrosoftAppPassword", appPassword);
private static void AddConfigurationSetting(string name, string value)
{
if (!ConfigurationManager.AppSettings.AllKeys.Contains(name))
{
ConfigurationManager.AppSettings[name] = value;
}
}
Upvotes: 1