【问题标题】:Team recording bot from scratch(error at response)从头开始团队录制机器人(响应错误)
【发布时间】:2022-06-26 09:09:17
【问题描述】:

我们正在使用机器人框架在 .netframework 4.7.2 中创建一个录制机器人。我们正在从头开始制作这个机器人。我们一度陷入困境。请查看下图以查看我们面临的错误:我们正在尝试做的是我们正在制作一个机器人控制器,并且在 (await Adapter.ProcessAsync(Request, Response, Bot)) 响应处出现错误.请看下面的代码:

using Microsoft.Bot.Builder;
using Microsoft.Bot.Builder.Integration.AspNet.WebApi;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using HttpGetAttribute = System.Web.Http.HttpGetAttribute;
using HttpPostAttribute = System.Web.Http.HttpPostAttribute;

namespace ScratchTeamrecordingBot.Controllers
{
   
        [System.Web.Http.Route("api/messages")]     
        public class HomeController : ApiController
    {
            private readonly IBotFrameworkHttpAdapter Adapter;
            private readonly IBot Bot;

            public HomeController(IBotFrameworkHttpAdapter adapter, IBot bot)
            {
                Adapter = adapter;
                Bot = bot;
            }

            [HttpPost, HttpGet]
            public async Task PostAsync()
            {
                // Delegate the processing of the HTTP POST to the adapter.
                // The adapter will invoke the bot.
                await Adapter.ProcessAsync`(Request, Response, Bot);
            }
        }
    
}

We are creating a recording bot in .netframework 4.7.2 using the bot framework. We are making this bot from scratch. we were stuck at one point. please see the image below to see the error we are facing: What we are trying to do is we are making a bot controller and in that, we are getting an error at ( await Adapter.ProcessAsync(Request, Response, Bot)) response. please see the code below:

【问题讨论】:

  • 你需要告诉我们错误到底是什么。红色波浪线没有告诉我们任何信息。您是否检查过 API 参考以了解您是否正确使用了该功能?

标签: botframework .net-4.8


【解决方案1】:

在 Visual Studio 中转到 查看 > 错误列表并检查错误消息。但很可能,您的错误是因为您使用的是 .Net Framework。如果您检查Response 对象的类型,您将看到Microsoft.AspNetCore.HttpResponse.IBotFrameworkHttpAdapter 的类型。我的建议是为您的项目使用 .Net Core。

有关 IBotFrameworkHttpAdapter 的信息,请转到 [此处]。(https://docs.microsoft.com/en-us/dotnet/api/microsoft.bot.builder.integration.aspnet.core.ibotframeworkhttpadapter?view=botbuilder-dotnet-stable)

希望这些信息对您有用:)

最好的尊重!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多