【问题标题】:How to connect BotFramework's EchoBot to a database?如何将 Bot Framework EchoBot 连接到数据库?
【发布时间】:2019-12-23 12:14:20
【问题描述】:

因此,我使用 C# 中的 Azure BotFramework 创建了一个机器人并下载了源代码。代码位于 .NET Core V 2.1

现在我想通过将聊天机器人连接到数据库来自定义聊天机器人,为此我创建了一个类 DAL.cs,添加一个类后,startup.cs 文件在 ConfigureServices 中引发错误

'EchoBot' 是一个命名空间,但用作类型

public void ConfigureServices(IServiceCollection services)
{
 services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

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

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

如何将其连接到数据库?

【问题讨论】:

    标签: c# botframework asp.net-core-2.1


    【解决方案1】:

    当命名空间和类名相同时会发生这种情况。您已声明与类名冲突的命名空间 namespace EchoBot。您必须将命名空间重命名为不同的名称。请参阅 this 博客以帮助更好地理解它。

    希望这会有所帮助。

    【讨论】:

      【解决方案2】:

      您似乎有一个名为 EchoBot 的命名空间,请将您的命名空间更新为另一个以解决错误

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-11-01
        • 1970-01-01
        • 2017-04-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-06-27
        相关资源
        最近更新 更多