Botframework Microsoft聊天机器人显示超出403配额错误

Botframework Microsoft聊天机器人显示超出403配额错误,botframework,azure-language-understanding,Botframework,Azure Language Understanding,在正确运行应用程序时,我收到了欢迎消息,我已经调用了我的luis类来获取匹配的意图。 在directline问题列表中获取此消息- 将此消息发送到您的bot时出错:HTTP状态代码InternalServerError 检查浏览器时,我收到此消息- 加载资源失败:服务器响应状态为502(坏网关) 虽然我已经检查了所有的钥匙,而且机器人以前工作得很好,但突然出现了这些问题 另外,在emulator中进行测试时,经过多次重试后,它仍能正常工作,但再次停止,并以bot回复为-抱歉,我的bot代码有问题

在正确运行应用程序时,我收到了欢迎消息,我已经调用了我的luis类来获取匹配的意图。 在directline问题列表中获取此消息- 将此消息发送到您的bot时出错:HTTP状态代码InternalServerError

检查浏览器时,我收到此消息- 加载资源失败:服务器响应状态为502(坏网关)

虽然我已经检查了所有的钥匙,而且机器人以前工作得很好,但突然出现了这些问题

另外,在emulator中进行测试时,经过多次重试后,它仍能正常工作,但再次停止,并以bot回复为-抱歉,我的bot代码有问题。

这是我的消息控制器代码- 公共类消息控制器:ApiController { 公共对象活动{get;private set;}

    /// <summary>
    /// POST: api/Messages
    /// Receive a message from a user and reply to it
    /// </summary>
    public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
    {
        if (activity.GetActivityType() == ActivityTypes.Message)
        {
            await Conversation.SendAsync(activity, () => new LuisClass());
        }
        else
        {
            await HandleSystemMessageAsync(activity);
        }
        var response = Request.CreateResponse(HttpStatusCode.OK);
        return response;
    }

    private async Task<Activity> HandleSystemMessageAsync( Activity message)
    {
        string messageType = message.GetActivityType();
        if (messageType == ActivityTypes.DeleteUserData)
        {
            // Implement user deletion here
            // If we handle user deletion, return a real message
        }



        else if (message.Type == ActivityTypes.ConversationUpdate)
        {
            if (message.MembersAdded.Any(o => o.Id == message.Recipient.Id))
            {
                ConnectorClient client = new ConnectorClient(new Uri(message.ServiceUrl));

                var reply = message.CreateReply();

                //reply.Text = "Welcome to Microsoft QaMaker Bot.How can i help you....?";
                reply.Text = "Hey there! I provide information on weather, stock and tableau. Ask me anything and I will try to answer";
                reply.Speak = "Hey there! I provide information on weather, stock and tableau. Ask me anything and I will try to answer";
                reply.InputHint = InputHints.AcceptingInput;
                await client.Conversations.ReplyToActivityAsync(reply);
            }
        }

        else if (messageType == ActivityTypes.ContactRelationUpdate)
        {
            // Handle add/remove from contact lists
            // Activity.From + Activity.Action represent what happened
        }
        else if (messageType == ActivityTypes.Typing)
        {
            // Handle knowing that the user is typing
        }
        else if (messageType == ActivityTypes.Ping)
        {
        }

        return null;
    }
}
//
///帖子:api/Messages
///接收来自用户的消息并回复
/// 
公共异步任务发布([FromBody]活动)
{
if(activity.GetActivityType()==ActivityTypes.Message)
{
等待对话。SendAsync(活动,()=>new LuisClass());
}
其他的
{
等待HandleSystemMessageAsync(活动);
}
var response=Request.CreateResponse(HttpStatusCode.OK);
返回响应;
}
专用异步任务HandleSystemMessageAsync(活动消息)
{
字符串messageType=message.GetActivityType();
if(messageType==ActivityTypes.DeleteUserData)
{
//在此处执行用户删除
//如果我们处理用户删除,返回一条真实的消息
}
else if(message.Type==ActivityTypes.ConversationUpdate)
{
if(message.MembersAdded.Any(o=>o.Id==message.Recipient.Id))
{
ConnectorClient=newConnectorClient(新Uri(message.ServiceUrl));
var reply=message.CreateReply();
//reply.Text=“欢迎使用Microsoft QaMaker Bot。我能为您提供什么帮助…”;
回复.Text=“嘿!我提供天气、股票和图表的信息。问我任何问题,我都会尽力回答”;
reply.Speak=“嘿!我提供天气、股票和图表的信息。问我任何问题,我都会尽力回答”;
reply.InputHint=InputHints.AcceptingInput;
等待client.Conversations.ReplyToActivityAsync(reply);
}
}
else if(messageType==ActivityTypes.ContactRelationUpdate)
{
//处理联系人列表中的添加/删除
//Activity.From+Activity.Action表示发生了什么
}
else if(messageType==ActivityTypes.Typing)
{
//知道用户正在键入的句柄
}
else if(messageType==ActivityTypes.Ping)
{
}
返回null;
}
}
路易斯密码- 在这里,我使用路易斯模型,并试图得到具体的匹配意图-

public class LuisClass : LuisDialog<object>
{
    //public List<CompanyStockPrice> DataResult { get; private set; }

    [LuisIntent("None")]
    public async Task None(IDialogContext context, LuisResult result)
    {
        await context.PostAsync("Sorry, I didn't quite get that. Please try again");
        context.Wait(MessageReceived);
    }

    [LuisIntent("General")]
    public async Task General(IDialogContext context, LuisResult result)
    {
        await context.PostAsync("Ask me anything and i will try to answer!");
        context.Wait(MessageReceived);
    }
公共类LuisClass:LuisDialog
{
//公共列表数据结果{get;private set;}
[路易辛顿(“无”)]
公共异步任务无(IDialogContext上下文,LuisResult结果)
{
wait context.PostAsync(“对不起,我不太明白,请再试一次”);
Wait(MessageReceived);
}
[路易辛顿(“一般”)]
公共异步任务常规(IDialogContext上下文,LuisResult结果)
{
等待上下文。PostAsync(“问我任何问题,我会尝试回答!”);
Wait(MessageReceived);
}
}

堆栈跟踪:

"{\r\n  \"message\": \"An error has occurred.\",\r\n  \"exceptionMessage\": 
"Response status code does not indicate success: 403 (Quota Exceeded).\",\r\n  \"exceptionType\":  
"System.Net.Http.HttpRequestException\",\r\n  \"stackTrace\": \"   
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()\\r\\n   
at Microsoft.Bot.Builder.Luis.LuisService.<Microsoft-Bot-Builder-Luis-ILuisService-QueryAsync>d__8.MoveNext() in D:\\\\a\\\\1\\\\s\\\\CSharp\\\\Library\\\\Microsoft.Bot.Builder\\\\Luis\\\\LuisService.cs:line 284\\r\\n--- 
End of stack trace from previous location where exception was thrown 
“{\r\n\”消息\:\”出现错误。\”,\r\n\“exceptionMessage\”:
“响应状态代码不表示成功:403(超出配额)。\”,\r\n\“exceptionType\”:
“System.Net.Http.HttpRequestException\”,\r\n“stackTrace\”:\”
在System.Net.Http.HttpResponseMessage.EnsureAccessStatusCode()上\\r\\n
在Microsoft.Bot.Builder.Luis.LuisService.d\u 8.MoveNext()中,在d:\\\\a\\\\1\\\\s\\\\CSharp\\\\Library\\\\\Microsoft.Bot.Builder\\\\\Luis\\\\\LuisService.cs:第284行\\r\\n--
来自引发异常的上一个位置的堆栈结束跟踪

对不起,但是你的描述似乎太笼统了,你能再多说一些关于你的BOT如何工作的细节吗?你能添加代码示例吗?你使用C??对话吗?如果你能得到这个问题的堆栈跟踪的话,那就好了。如果你在Azure上测试,考虑使用来测试好像BOT是本地的。端点较早。当使用路易斯的钥匙时,现在新的终点是-@FerdinandFejskid很好地理解了你的观点,我为westus创建了一把新钥匙,现在它工作良好。非常感谢!太好了!我想你现在可以写下你的“故事”作为答案并接受它:-),也许还请尝试缩短stacktrace。