我们在最新的Bot SDK中为客户构建了一个漫游器,但在对话开始时随机出现“未经授权”错误。
看到下面的错误,这很奇怪,因为:
我们仍然在MemoryStorage上,但不要认为这与它有任何关系。
框架版本:
任何人对此的解决方案
Microsoft.Bot.Schema.ErrorResponseException: Operation returned an invalid status code 'Unauthorized'
at Microsoft.Bot.Connector.Conversations.ReplyToActivityWithHttpMessagesAsync(String conversationId, String activityId, Activity activity, Dictionary`2 customHeaders, CancellationToken cancellationToken)
at Microsoft.Bot.Connector.ConversationsExtensions.ReplyToActivityAsync(IConversations operations, String conversationId, String activityId, Activity activity, CancellationToken cancellationToken)
at Microsoft.Bot.Builder.BotFrameworkAdapter.SendActivitiesAsync(ITurnContext turnContext, Activity[] activities, CancellationToken cancellationToken)
at Microsoft.Bot.Builder.TurnContext.<>c__DisplayClass22_0.<<SendActivitiesAsync>g__SendActivitiesThroughAdapter|1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Bot.Builder.TurnContext.SendActivityAsync(IActivity activity, CancellationToken cancellationToken)
at Microsoft.Bot.Builder.TurnContext.SendActivityAsync(String textReplyToSend, String speak, String inputHint, CancellationToken cancellationToken)
at Louise.Chatbot.DialogSteps.GreetingDialogSteps.GreetUserAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) in C:\Users\.......\GreetingDialogSteps.cs:line 26
at Microsoft.Bot.Builder.Dialogs.WaterfallDialog.OnStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
at Microsoft.Bot.Builder.Dialogs.WaterfallDialog.RunStepAsync(DialogContext dc, Int32 index, DialogReason reason, Object result, CancellationToken cancellationToken)
at Microsoft.Bot.Builder.Dialogs.WaterfallDialog.BeginDialogAsync(DialogContext dc, Object options, CancellationToken cancellationToken)
at Microsoft.Bot.Builder.Dialogs.DialogContext.BeginDialogAsync(String dialogId, Object options, CancellationToken cancellationToken)
at Louise.Chatbot.Louise.OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken) in C:\Users\.......\Louise.cs:line 154
at Microsoft.Bot.Builder.MiddlewareSet.ReceiveActivityWithStatusAsync(ITurnContext turnContext, BotCallbackHandler callback, CancellationToken cancellationToken)
at Microsoft.Bot.Builder.BotAdapter.RunPipelineAsync(ITurnContext turnContext, BotCallbackHandler callback, CancellationToken cancellationToken)
答案 0 :(得分:2)
每[{https://github.com/Microsoft/botbuilder-dotnet/issues/1251][1]
“这可能是v4 SDK中的令牌缓存错误。上一版本,在V3 C#SDK中,我们不再使用自定义代码,而是使用AAD团队提供的交钥匙解决方案。到目前为止,似乎运行良好,并且我们对该解决方案感到满意。作为这项工作的一个不错的副作用,在非常高的负载下的性能也要好很多。
这项工作目前正在v4 C#SDK中进行,并计划于2月中旬在4.3版本中进行。”