LUIS异常:操作返回了无效的状态码“禁止”

时间:2019-03-30 08:28:10

标签: c# azure botframework luis

遇到这样的错误。之前只是某个时间。 现在,即使是简单的“嗨”,它也给了我这个例外。

请帮助。

Exception caught : Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Models.APIErrorException: Operation returned an invalid status code 'Forbidden'




=============================
 Exception caught : Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Models.APIErrorException: Operation returned an invalid status code 'Forbidden'
         at Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Prediction.ResolveWithHttpMessagesAsync(String appId, String query, Nullable`1 timezoneOffset, Nullable`1 verbose, Nullable`1 staging, Nullable`1 spellCheck, String bingSpellCheckSubscriptionKey, Nullable`1 log, Dictionary`2 customHeaders, CancellationToken cancellationToken)
         at Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.PredictionExtensions.ResolveAsync(IPrediction operations, String appId, String query, Nullable`1 timezoneOffset, Nullable`1 verbose, Nullable`1 staging, Nullable`1 spellCheck, String bingSpellCheckSubscriptionKey, Nullable`1 log, CancellationToken cancellationToken)
         at Microsoft.Bot.Builder.AI.Luis.LuisRecognizer.RecognizeInternalAsync(ITurnContext turnContext, CancellationToken cancellationToken) in D:\a\1\s\libraries\Microsoft.Bot.Builder.AI.LUIS\LuisRecognizer.cs:line 413
         at Microsoft.Bot.Builder.AI.Luis.LuisRecognizer.RecognizeAsync(ITurnContext turnContext, CancellationToken cancellationToken) in D:\a\1\s\libraries\Microsoft.Bot.Builder.AI.LUIS\LuisRecognizer.cs:line 104
         at Microsoft.BotBuilderSamples.BasicBot.OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken) in C:\Users\Gokul.Gopinath\Desktop\A-BI\GokulAssistanceEngine-src\BasicBot.cs:line 115
         at Microsoft.Bot.Builder.MiddlewareSet.ReceiveActivityWithStatusAsync(ITurnContext turnContext, BotCallbackHandler callback, CancellationToken cancellationToken) in D:\a\1\s\libraries\Microsoft.Bot.Builder\MiddlewareSet.cs:line 55
         at Microsoft.Bot.Builder.BotAdapter.RunPipelineAsync(ITurnContext turnContext, BotCallbackHandler callback, CancellationToken cancellationToken) in D:\a\1\s\libraries\Microsoft.Bot.Builder\BotAdapter.cs:line 167

1 个答案:

答案 0 :(得分:2)

即使最初的问题没有遵循mcve,使用LUIS时也存在两个与403相关的常见陷阱。

创作/订阅密钥错误或没有

使用LUIS处理来自网络的样本时,必须提供LUIS应用程序的订阅和创作密钥。在最新的机器人生成器示例中,它通常位于*.bot文件中,如图here所示。

official documentation中描述了编写键和查询的概念。

403超出通话量配额

您已达到LUIS启动键的配额限制。为了永久解决此问题,请遵循我的指导here