在哪里为本地计算机上的Microsoft.Bot.Builder.Azure.Utils.GetAppSetting设置值? [英] Where to set Value for Microsoft.Bot.Builder.Azure.Utils.GetAppSetting on local machine?

查看:37
本文介绍了在哪里为本地计算机上的Microsoft.Bot.Builder.Azure.Utils.GetAppSetting设置值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从azure的bot应用程序中下载了示例代码,有一行我不确定配置值应该存储在哪里.我尝试不更改代码,因为以后我需要重新发布回azure服务器.所以对于这一行

I downloaded the sample code from azure's bot app, and there is a line which i'm not sure where is the config value should be store. i try not to change the code as later i need publish back into azure server. So for this line

var qnaKBId = Utils.GetAppSetting("QnAKnowledgebaseId");

当我需要在本地计算机上进行编码时,应在哪里在上面创建变量?

Where should i create the variable for above when i need to code on my local machine?

我尝试在web.config中创建变量,但该变量为null.和指定任何细节.

I tried create the variable in web.config but it getting null. and the document not specify any detail.

推荐答案

在文档中,我们可以找到

In documentation, we can find that Microsoft.Bot.Builder.Azure.Utils is a utility class for bots running on Azure.

我尝试在web.config中创建变量,但该变量为空.

I tried create the variable in web.config but it getting null.

如果您想在本地运行bot应用程序并访问web.config文件中的设置,则可以使用以下代码段在bot应用程序中对其进行检索.

If you’d like to run your bot application on local and access settings from your web.config file, you can use the following code snippet to retrieve it in your bot application.

var qnaKBId = ConfigurationManager.AppSettings["QnAKnowledgebaseId"];

这篇关于在哪里为本地计算机上的Microsoft.Bot.Builder.Azure.Utils.GetAppSetting设置值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆