该操作在Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime返回了无效的状态码“ Forbidden”。

时间:2019-09-17 22:03:58

标签: .net .net-core botframework luis

我的机器人运行正常,但突然出现以下错误:操作返回了无效的状态码“禁止”

知道发生了什么事。 几天前,我注意到一些电子邮件通知,说明“ 您正在接近订阅LUIS API-免费产品的配额限制。此配额将在2019年9月26日更新。

此错误与我对LUIS API的订阅配额限制有关吗?如何升级?

Operation returned an invalid status code ‘Forbidden’
at Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Prediction.ResolveWithHttpMessagesAsync(String appId, String query, Nullable1 timezoneOffset, Nullable1 verbose, Nullable1 staging, Nullable1 spellCheck, String bingSpellCheckSubscriptionKey, Nullable1 log, Dictionary2 customHeaders, CancellationToken cancellationToken)
at Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.PredictionExtensions.ResolveAsync(IPrediction operations, String appId, String query, Nullable1 timezoneOffset, Nullable1 verbose, Nullable1 staging, Nullable1 spellCheck, String bingSpellCheckSubscriptionKey, Nullable1 log, CancellationToken cancellationToken) at Microsoft.Bot.Builder.AI.Luis.LuisRecognizer.RecognizeInternalAsync(ITurnContext turnContext, Dictionary2 telemetryProperties, Dictionary2 telemetryMetrics, CancellationToken cancellationToken) at Microsoft.Bot.Builder.AI.Luis.LuisRecognizer.RecognizeAsync[T](ITurnContext turnContext, CancellationToken cancellationToken)

更新

我将我的luis应用程序升级到了标准层。但是我仍然面临着同样的错误

2 个答案:

答案 0 :(得分:2)

根据异常信息,您的LUIS API服务层是免费的,并且已达到配额限制,从而导致403 forbidden error。有关LUIS API定价的详细信息,请参见here

enter image description here

如果要对LUIS API服务层分级,请转到Azure门户并选择您的LUIS服务,然后单击“定价层”对其进行升级: enter image description here

答案 1 :(得分:1)

仅升级到标准层将无法解决此错误。

这是我解决问题的方式

--> upgraded LUIS app to standard tier
--> regenerated the primary Key, updated in key vault 
--> Go to Luis.AI >>application settings>>Azure resources >>"Add prediction resource" ,

        pricing tier should show as "standard" and the your expected Region
-> publish your luis app

此“未经授权”错误消失