简体   繁体   English

Azure源代码中没有bot扩展文件

[英]There is no bot extension file in azure source code

I am new to azure bot service. 我是Azure机器人服务的新手。 I have created new bot first time and downloaded the source code from azure portal. 我第一次创建了新的bot,并从azure门户下载了源代码。 In the source code there is a bot extension settings file. 在源代码中,有一个bot扩展程序设置文件。 There all bot related settings are placed. 放置了所有与机器人相关的设置。 My problem is, again I have created new bot and downloaded the source code from azure portal. 我的问题是,我再次创建了新的漫游器并从azure门户下载了源代码。 But there is no any bot extension file is exists in the source code. 但是源代码中不存在任何bot扩展文件。 How can I get the bot extension settings file. 如何获取Bot扩展程序设置文件。 Please give your suggestion. 请提出您的建议。

The bot framework team is moving away from storing bot information in the .bot file, and is now putting the keys in appsettings.json. Bot框架团队正在远离将Bot信息存储在.bot文件中的方法,现在将密钥放入appsettings.json中。 Bot source code downloaded off Azure now follows this principle, and should include a ConfigurationCredentialProvider.cs that will look for the info in your appsettings.json: 从Azure上下载的Bot源代码现在遵循此原则,并且应包含ConfigurationCredentialProvider.cs,它将在appsettings.json中查找信息:

public class ConfigurationCredentialProvider : SimpleCredentialProvider
{
    public ConfigurationCredentialProvider(IConfiguration configuration)
        : base(configuration["MicrosoftAppId"], configuration["MicrosoftAppPassword"])
    {
    }
}

This ConfigurationCredentialProvider is added as a singleton in the Startup.cs file: 此ConfigurationCredentialProvider作为单例添加到Startup.cs文件中:

// This method gets called by the runtime. Use this method to add services to the container.
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

        if (!string.IsNullOrEmpty(Configuration[BotOpenIdMetadataKey]))
            ChannelValidation.OpenIdMetadataUrl = Configuration[BotOpenIdMetadataKey];

        // Create the credential provider to be used with the Bot Framework Adapter.
        services.AddSingleton<ICredentialProvider, ConfigurationCredentialProvider>();

        // Create the Bot Framework Adapter.
        services.AddSingleton<IBotFrameworkHttpAdapter, BotFrameworkHttpAdapter>();

        // Create the bot as a transient. In this case the ASP Controller is expecting an IBot.
        services.AddTransient<IBot, EchoBot>();
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM