首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将聊天机器人连接到cosmos db后出错500

将聊天机器人连接到cosmos db后出错500
EN

Stack Overflow用户
提问于 2018-06-11 05:05:30
回答 1查看 181关注 0票数 1

我有一个问题,在连接我的天蓝色聊天机器人到蔚蓝宇宙数据库,我尝试运行在我的在线编辑器和可视工作室本地,但它不能在这两个平台上运行。

错误在这里:

代码语言:javascript
复制
System.TypeLoadException
Could not resolve type with token 01000060 (from typeref, class/assembly System.Diagnostics.Eventing.EventProviderTraceListener, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
Description: HTTP 500.Error processing request.

Details: Non-web exception. Exception origin (name of application or object): Microsoft.Azure.Documents.Client.

代码:

代码语言:javascript
复制
protected void Application_Start()
{

 var uri = new Uri(ConfigurationManager.AppSettings["DocumentDbUrl"]);
    var key = ConfigurationManager.AppSettings["DocumentDbKey"];
    var store = new DocumentDbBotDataStore(uri, key);

    Conversation.UpdateContainer(
                builder =>
                {
                    builder.Register(c => store)
                        .Keyed<IBotDataStore<BotData>>(AzureModule.Key_DataStore)
                        .AsSelf()
                        .SingleInstance();

                    builder.Register(c => new CachingBotDataStore(store, CachingBotDataStoreConsistencyPolicy.ETagBasedConsistency))
                        .As<IBotDataStore<BotData>>()
                        .AsSelf()
                        .InstancePerLifetimeScope();

                });
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-06-11 20:17:24

看看这里的示例:https://github.com/Microsoft/BotBuilder-Azure/blob/master/CSharp/Samples/DocumentDb/Global.asax.cs,它还注册了AzureModule。你试过吗?

代码语言:javascript
复制
Conversation.UpdateContainer(
    builder =>
    {
        builder.RegisterModule(new AzureModule(Assembly.GetExecutingAssembly()));

        var store = new DocumentDbBotDataStore(docDbEmulatorUri, docDbEmulatorKey);

        builder.Register(c => store)
            .Keyed<IBotDataStore<BotData>>(AzureModule.Key_DataStore)
            .AsSelf()
            .SingleInstance();

        // Register your Web API controllers.
        builder.RegisterApiControllers(Assembly.GetExecutingAssembly());
        builder.RegisterWebApiFilterProvider(config);

    });
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50790784

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档