团队从头开始录制机器人(响应错误)

发布于 2025-01-27 02:32:35 字数 1868 浏览 3 评论 0原文

我们正在使用Bot Framework在.netframework 4.7.2中创建一个录制bot。我们正在从头开始制作此机器人。我们被困在某一时刻。请参阅下图以查看我们面临的错误:我们要做的是我们正在制作一个bot控制器,在此中,我们在(等待Adapter.processasync(请求,响应,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:

enter image description hereWe 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:

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:

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

请持续率性 2025-02-03 02:32:35

转到 View>错误列表在Visual Studio中并检查错误消息。但是可能,您的错误是因为您正在使用.NET框架。如果您检查响应对象的类型,您将看到Microsoft.aspnetcore.httpresponse.ibotframeworkhttpadapter的类型。我的推荐是将.NET核心用于您的项目。

有关ibotframeworkhttpadapter go 在这里

希望您发现此信息有用:)

最好的考虑!

Go to View > Error List in Visual Studio and check the error message. But probably, your error is because you are using .Net Framework. If you check the type of the Response object you will see is type of Microsoft.AspNetCore.HttpResponse.IBotFrameworkHttpAdapter. My recomendation is to use .Net Core for your project.

For information about the IBotFrameworkHttpAdapter go here

Hope you find this information useful :)

Best regard!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文