首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法加载类型的Microsoft.Bot.Builder.Internals.Fibers.SetField

无法加载类型的Microsoft.Bot.Builder.Internals.Fibers.SetField
EN

Stack Overflow用户
提问于 2019-02-21 13:11:45
回答 1查看 111关注 0票数 0

我正在使用BotFrameworkSDKV-4并尝试使用QnAMakerService

我有BotService.cs,其中有QnAMakerService实例。在启动QnAMakerService时,我在Visual诊断窗口中得到一个错误:

无法加载类型的Microsoft.Bot.Builder.Internals.Fibers.SetField

下面是我的密码。我已经评论了我得到错误的那一行:

代码语言:javascript
复制
public BotServices(BotConfiguration botConfiguration)
{
    foreach (var service in botConfiguration.Services)
    {
        switch (service.Type)
        {
            case ServiceTypes.QnA:
                {
                    var qna = (Microsoft.Bot.Configuration.QnAMakerService)service;
                    if (qna == null)
                    {
                        throw new InvalidOperationException("The QnA service is not configured correctly in your '.bot' file.");
                    }

                    if (string.IsNullOrWhiteSpace(qna.KbId))
                    {
                        throw new InvalidOperationException("The QnA KnowledgeBaseId ('kbId') is required to run this sample. Please update your '.bot' file.");
                    }

                    if (string.IsNullOrWhiteSpace(qna.EndpointKey))
                    {
                        throw new InvalidOperationException("The QnA EndpointKey ('endpointKey') is required to run this sample. Please update your '.bot' file.");
                    }

                    if (string.IsNullOrWhiteSpace(qna.Hostname))
                    {
                        throw new InvalidOperationException("The QnA Host ('hostname') is required to run this sample. Please update your '.bot' file.");
                    }

                    string defaultMessage = "Sorry no answer found.";
                    QnAMakerAttribute qnAMakerAttribute = new QnAMakerAttribute(qna.EndpointKey, qna.KbId, defaultMessage, 40, 5, <end_point>);
                    var qnaMakerService = new Microsoft.Bot.Builder.CognitiveServices.QnAMaker.QnAMakerService(qnAMakerAttribute); // Error is here
                    qnaMakerServices.Add(qna.Name, qnaMakerService);
                    break;
                }
        }
    }
}

早些时候,我在同一个端点上使用了本机Http调用,并且运行良好。知道我做错了什么吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-02-21 17:20:40

@SouvikGhosh Daniel是正确的,这里的依赖版本不匹配。

正如您在微软文档中看到的那样,Fiber类应用于Microsoft.Bot.Builder v3

QnAMaker在v4中需要的是Microsoft.Bot.Builder.AI.QnA for C#:https://github.com/Microsoft/botbuilder-dotnet/tree/master/libraries/Microsoft.Bot.Builder.AI.QnA

博士只需确保您只有v4依赖关系,而不是v3和v4的混合。

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

https://stackoverflow.com/questions/54807951

复制
相关文章

相似问题

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