Bot Framework测试与您的漫游器的连接失败,状态代码为禁止 [英] Bot Framework Test connection to your bot fails with status code Forbidden

查看:99
本文介绍了Bot Framework测试与您的漫游器的连接失败,状态代码为禁止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的机器人可以在Slack,Skype和模拟器中正常接收和发送消息.

My bot works receives and sends messages fine in Slack, Skype and emulator.

但是,当我单击bot门户中的蓝色测试"按钮时( https://dev.botframework.com/),它给我错误消息"Microsoft App ID my_id_is_replacedhere的授权失败,状态码为禁止"

However when I click the blue Test button in the bot portal (https://dev.botframework.com/) it gives me the error message "Authorization for Microsoft App ID my_id_is_replacedhere failed with status code Forbidden"

完全错误如下.

当我使用端点 https://slack.botframework向Slack发送预定消息时,也会遇到相同的错误. com/和Conversations.SendToConversation()方法.这曾经起作用,而测试"按钮曾经成功.

I also get the same error when I send a scheduled message to Slack using endpoint https://slack.botframework.com/ and the Conversations.SendToConversation() method. This used to work and the Test button used to succeed.

我为什么收到此消息?是否有破坏它的NuGet pkg更新? 我仔细阅读了故障排除指南,但其他所有内容似乎都可以正常工作.

Why am I getting this message? Is there a NuGet pkg update that broke it? I went through the troubleshooting guide, but everything else seem to work.

谢谢

InternalServerError {消息":发生了错误.", "exceptionMessage":对Microsoft App ID的授权 my_id_is_replacedhere失败,状态码为禁止", "exceptionType":"System.UnauthorizedAccessException","stackTrace": 在 Microsoft.Bot.Connector.JwtTokenRefresher.d__2.MoveNext()\ r \ n --- 从先前引发异常的位置开始的堆栈跟踪结束 --- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务)\ r \ n位于 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)\ r \ n位于 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(任务任务)\ r \ n 在 Microsoft.Bot.Connector.Conversations.d__8.MoveNext()\ r \ n --- 从先前引发异常的位置开始的堆栈跟踪结束 --- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务)\ r \ n位于 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)\ r \ n位于 Microsoft.Bot.Connector.ConversationsExtensions.d__19.MoveNext()\ r \ n --- 从先前引发异常的位置开始的堆栈跟踪结束 --- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务)\ r \ n位于 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)\ r \ n位于 System.Runtime.CompilerServices.TaskAwaiter1.GetResult()\ r \ n位于 Grasp.MessagesController.d__0.MoveNext()在 C:\ Code \ Relegraph_Git \ GraspThree \ Grasp \ Controllers \ MessagesController.cs:line 55 \ r \ n--从异常发生的先前位置开始的堆栈结束跟踪 被扔了--- \ r \ n System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务)\ r \ n位于 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)\ r \ n位于 System.Threading.Tasks.TaskHelpersExtensions.d__3`1.MoveNext()\ r \ n-- 从先前引发异常的位置开始的堆栈跟踪结束 --- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务)\ r \ n位于 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)\ r \ n位于 System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext()\ r \ n-- 从先前引发异常的位置开始的堆栈跟踪结束 --- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务)\ r \ n位于 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)\ r \ n位于 System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext()\ r \ n --- 从先前引发异常的位置开始的堆栈跟踪结束 --- \ r \ n在System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext()\ r \ n-- 从先前引发异常的位置开始的堆栈跟踪结束 --- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务)\ r \ n位于 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)\ r \ n位于 System.Web.Http.Filters.ActionFilterAttribute.d__0.MoveNext()\ r \ n --- 从先前引发异常的位置开始的堆栈跟踪结束 --- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务)\ r \ n位于 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)\ r \ n位于 System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext()\ r \ n --- 从先前引发异常的位置开始的堆栈跟踪结束 --- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务)\ r \ n位于 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)\ r \ n位于 System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext() }

InternalServerError { "message": "An error has occurred.", "exceptionMessage": "Authorization for Microsoft App ID my_id_is_replacedhere failed with status code Forbidden", "exceptionType": "System.UnauthorizedAccessException", "stackTrace": " at Microsoft.Bot.Connector.JwtTokenRefresher.d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)\r\n at Microsoft.Bot.Connector.Conversations.d__8.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Connector.ConversationsExtensions.d__19.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()\r\n at Grasp.MessagesController.d__0.MoveNext() in C:\Code\Relegraph_Git\GraspThree\Grasp\Controllers\MessagesController.cs:line 55\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Threading.Tasks.TaskHelpersExtensions.d__3`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()" }

推荐答案

我弄清楚了导致错误的原因.显然,僵尸程序门户中的测试"按钮会向僵尸程序发送"Ping"消息.在我的MessagesController代码中,我试图用以下方式回复每条消息:

I figured out what caused the error. Apparently the Test button in the bot portal sends a "Ping" message to the bot. In my MessagesController code I was trying to reply to every message with something like this:

                        ConnectorClient connector = new ConnectorClient(new Uri(Act.ServiceUrl), appcred);
                        Activity reply = Act.CreateReply(replymsg);
                        connector.Conversations.ReplyToActivity(reply);

但是-对活动的Ping类型执行此操作(Activity.Type = ActivityTypes.Ping)时,出现上述错误.当我只是忽略Ping消息时,测试"按钮就会起作用.

However - when I do this for the Ping type of Activity (Activity.Type=ActivityTypes.Ping), then I get the above error. When I just ignore the Ping message, then the Test button works.

按计划将消息发送到Slack时遇到相同的错误时,我仍然遇到问题(没有传入的消息要回复).我使用Slack的WebAPI解决了这个问题:

I still had an issue when I get the same error when sending messages to Slack on a schedule (no incoming message to reply to). I worked around that issue using Slack's WebAPI:

https://slack.com/api/chat.postMessage?token= {0}& channel = {1}& text = {2}& as_user = {3}

https://slack.com/api/chat.postMessage?token={0}&channel={1}&text={2}&as_user={3}

这篇关于Bot Framework测试与您的漫游器的连接失败,状态代码为禁止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆