- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用 .net 框架创建了一个简单的机器人。收到消息但回复时,应用抛出如下异常
System.AggregateException: One or more errors occurred. ---> System.UnauthorizedAccessException: Authorization for Microsoft App ID xxx failed with status code Unauthorized and reason phrase 'Unauthorized' ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 401 (Unauthorized).
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at Microsoft.Bot.Connector.JwtTokenRefresher.<SendAsync>d__2.MoveNext()
--- End of inner exception stack trace ---
at Microsoft.Bot.Connector.JwtTokenRefresher.<SendAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Microsoft.Bot.Connector.BotState.<GetConversationDataWithHttpMessagesAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Connector.BotStateExtensions.<GetConversationDataAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.ConnectorStore.<Microsoft-Bot-Builder-Dialogs-Internals-IBotDataStore<Microsoft-Bot-Connector-BotData>-LoadAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.CachingBotDataStore.<LoadFromInnerAndCache>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.CachingBotDataStore.<Microsoft-Bot-Builder-Dialogs-Internals-IBotDataStore<Microsoft-Bot-Connector-BotData>-LoadAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.BotDataBase`1.<LoadData>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.BotDataBase`1.<LoadAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.DialogTaskManagerBotDataLoader.<LoadAsync>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.PersistentDialogTask.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.ExceptionTranslationDialogTask.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.SerializeByConversation.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.PostUnhandledExceptionToUser.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Bot.Builder.Dialogs.Internals.PostUnhandledExceptionToUser.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.LogPostToBot.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Conversation.<SendAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Conversation.<SendAsync>d__6.MoveNext()
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.UnauthorizedAccessException: Authorization for Microsoft App ID 9d88e9f7-289e-45d2-8215-8f539955335d failed with status code Unauthorized and reason phrase 'Unauthorized' ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 401 (Unauthorized).
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at Microsoft.Bot.Connector.JwtTokenRefresher.<SendAsync>d__2.MoveNext()
--- End of inner exception stack trace ---
at Microsoft.Bot.Connector.JwtTokenRefresher.<SendAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Microsoft.Bot.Connector.BotState.<GetConversationDataWithHttpMessagesAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Connector.BotStateExtensions.<GetConversationDataAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.ConnectorStore.<Microsoft-Bot-Builder-Dialogs-Internals-IBotDataStore<Microsoft-Bot-Connector-BotData>-LoadAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.CachingBotDataStore.<LoadFromInnerAndCache>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.CachingBotDataStore.<Microsoft-Bot-Builder-Dialogs-Internals-IBotDataStore<Microsoft-Bot-Connector-BotData>-LoadAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.BotDataBase`1.<LoadData>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.BotDataBase`1.<LoadAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.DialogTaskManagerBotDataLoader.<LoadAsync>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.PersistentDialogTask.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.ExceptionTranslationDialogTask.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.SerializeByConversation.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.PostUnhandledExceptionToUser.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Bot.Builder.Dialogs.Internals.PostUnhandledExceptionToUser.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Internals.LogPostToBot.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Conversation.<SendAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Bot.Builder.Dialogs.Conversation.<SendAsync>d__6.MoveNext()<---
代码
open System
open System.Text
open Hopac
open Hopac.Hopac
open Microsoft.Bot.Connector
open Suave
open Suave.Successful
open Suave.Filters
open Suave.Operators
open Microsoft.Bot.Builder.Dialogs
open Newtonsoft.Json
open System.Threading.Tasks
open Microsoft.Bot.Builder.Dialogs.Internals
type RootDialog () =
let rec onMessageReceived (context: IDialogContext) (result: IAwaitable<obj>) =
job {
//let! activity = result
do! context.PostAsync ("Sweet") |> Job.awaitUnitTask
context.Wait (ResumeAfter onMessageReceived) }
|> startAsTask |> unbox
interface IDialog<obj> with
member x.StartAsync (context: IDialogContext) =
context.Wait (ResumeAfter (onMessageReceived))
Task.CompletedTask
let getActivity request =
let body = request.rawForm |> Encoding.UTF8.GetString
let activity = JsonConvert.DeserializeObject<Activity> (body)
activity
let handleSystemMessage (activity: Activity) =
match activity.Type with
| ActivityTypes.DeleteUserData
| _ -> ()
let post (activity: Activity) ctx =
job {
match activity.Type with
| ActivityTypes.Message ->
do! Conversation.SendAsync (activity, fun () -> RootDialog() :> _) |> Job.awaitUnitTask
| _ -> handleSystemMessage activity
return! OK "Got it" ctx }
let part =
choose [
POST >=> path "/bot/messages" >=> request (getActivity >> (fun a b -> post a b |> Job.toAsync)) ]
附言:
我遵循了教程 here它在第 3 步失败。禁用安全性时一切正常。
检查 fiddler 显示向 login.microsoftonline.com
发出了多个请求,并且所有此类请求都成功了,所以我认为这不是凭据。可能是什么问题?
最佳答案
最后,解决方案是在 do 之前添加以下行!对话.SendAsync ...
MicrosoftAppCredentials.TrustServiceUrl (activity.ServiceUrl)
附言:我不太确定为什么必须这样做,但对此原因的任何评论都可能有助于使解决方案更有意义。
关于.net - 如何解决 "System.UnauthorizedAccessException: Authorization for Microsoft App ID xxx failed with status code Unauthorized",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44402216/
我对文档有点困惑。请纠正我。 git 状态- 显示当前本地工作目录状态 git status -u- 显示未跟踪的文件(也是本地的) git 状态 -uno- 不显示未跟踪的文件(也是本地的)?? 后
我有一个具有 12 个虚拟机资源的 ARM 模板。每个虚拟机都有 1 个与其关联的 CustomLinuxScript 扩展资源。 某些 CustomLinuxScript 扩展失败并出现错误:状态文
我有一个具有 12 个虚拟机资源的 ARM 模板。每个虚拟机都有 1 个与其关联的 CustomLinuxScript 扩展资源。 某些 CustomLinuxScript 扩展失败并出现错误:状态文
我有以下 JavaScript 代码: alert(data.status); data 是一个 JSON 对象,其字段之一是 status ( bool 字段)。 当JSON.stringify(d
我在验证表单时遇到此错误,如何解决它。 代码: app.post('/',[ check('username','Error occured in Username').trim().isEmai
我正在开发一个使用 fork() exec() wait() 的 C 程序。第一个进程有以下代码: int main(int argc, const char * argv[]) { // inser
我想在 git status 上运行 linter,但是似乎没有 pre-status 和 post-status Hook 。 如何给 git 添加一个钩子(Hook)? fine docs对此事保
我需要获取所有 current_user.friends 状态,然后按 created_at 对它们进行排序。 class User a.created_at } end current_user.
我在 Eloquent 中使用 orWhere 时遇到问题。 我有一个团队,这个团队有一些资料。我想获取状态 = 1 或状态 = 2 的所有配置文件。但我无法让它工作。 我的代码是这样的: $prof
http://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic.html#INISCRPTACT 根据这
我们在 IIS 6.0 上托管 WCF 服务的服务器之一上观察到以下行为: IIS 日志显示所用时间的值较高 (> 100000) HTTP 状态码是 200 sc-win32-status 代码显示
在 Dynamics CRM 中,潜在客户实体同时具有状态和状态原因。使用 API 我可以获得所有状态原因。我被绊倒的地方是当我的用户选择状态原因时我想倒退并找出哪个状态与所选状态原因相关联。 以下是
我很好奇返回响应和仅创建响应的区别。 我见过大量使用 return res.status(xxx).json(x) 的代码示例和res.status(xxx).json(x) . 谁能详细解释一下两者
文档并没有真正说明 status 是什么。 status 到底是什么? http://man7.org/linux/man-pages/man2/exit_group.2.html 最佳答案 来自ex
An earlier question导致了一些关于如何检查 Git 存储库是否包含脏索引或未跟踪文件的想法。我从那次讨论中采纳的答案如下: #!/bin/sh exit $(git status -
ECSHOP出现 XMlHttpRequest status:[500] Unknow status 这个错误 把/admin/templates/top.htm 这个文件中{insert_scr
我有以下代码用于通过 Twitter4J 获取推文: List statuses; Paging paging = new Paging(1, LIMIT); statuses = twitter.g
非常不言自明。我正在制作一个脚本并且遇到了被使用和解析的情况,但它们的输出似乎总是完全相同。 最佳答案 git status --branch --porcelain "显示分支的状态(ahead,
我有一张表,上面有如下记录 表A subid clickid status datetime 1 123 low 2018-07-24 20:20:44 2 123
如果确实缺少资源,我的 API 将返回以下内容 { "code": 404, "message": "HTTP 404 Not Found" } 当我使用代码 Response.sta
我是一名优秀的程序员,十分优秀!