2
votes

my bot suddenly stopped wirking ...

I have create a bot using botframework, luis.ai c# . I have deploy in azure .

The bot was working very good , but now i get this code when i send a message to my bot : There was an error sending this message to your bot: HTTP status code InternalServerError .

I try to generate another key in my luis.ai and i added in my code ...but still i have the same problem .

P.S my botframework is updated with the last version.

MessagesController.cs :

using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Connector;

namespace FirstBotApplication
{
//[BotAuthentication]
public class MessagesController : ApiController
{
    /// <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.Type == ActivityTypes.Message)
        {
            await Conversation.SendAsync(activity, () => new AllTheBot());
        }
        else
        {
            HandleSystemMessage(activity);
        }
        var response = Request.CreateResponse(HttpStatusCode.OK);
        return response;
    }

    private Activity HandleSystemMessage(Activity message)
    {
        if (message.Type == ActivityTypes.DeleteUserData)
        {
            // Implement user deletion here
            // If we handle user deletion, return a real message
        }
        else if (message.Type == ActivityTypes.ConversationUpdate)
        {

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

        return null;
      }
     }
    }

AllTheBot.cs

using Microsoft.Bot.Builder.Dialogs;
  using Microsoft.Bot.Builder.Luis;
 using Microsoft.Bot.Builder.Luis.Models;
  using Microsoft.Bot.Connector;
 using System;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
 using System.Threading.Tasks;
 using System.Web;


namespace FirstBotApplication
{
//  [LuisModel("Please Enter Your LUIS Model ID", "Please Enter Your LUIS 
Subscription Key")]

[Serializable]

[LuisModel("xxxxxxxx", 
                        "yyyyyyy")]

public class AllTheBot : LuisDialog<object>
{
    // internal static string results;
    [LuisIntent("None")]
    [LuisIntent("")]
    public async Task None(IDialogContext context, LuisResult result)
    {
        string message = $"Sorry, I did not understand '{result.Query}'. Please reformulate your question";

        await context.PostAsync(message);

        context.Wait(this.MessageReceived);

}


    // private const string HeroCard = "Hero card";




    [LuisIntent("grettings")]
    [LuisIntent("intentfr")]
    public async Task Greeting(IDialogContext context, 
    IAwaitable<IMessageActivity> activity, LuisResult result)
    {


            await context.PostAsync("Welcome  ");

            context.Wait(MessageReceived);

    }`
       }}
2
Can you update this post with the code in question? It is a bit hard to give suggestions otherwise...mjwills
Which line is generating the error?mjwills
when i test in botframework emulator ( version updated )..i cannot connect cause of this message : write EPROTO 101057795:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:c:\jenkins\workspace\electron-win-x64\vendor\node\deps\openssl\openssl\ssl\s23_clnt.c:794user2455143
Add AppInsights to your Bot and go have a look to the exception loggedNicolas R

2 Answers

0
votes

Does the code you posted here match your code in exactly, if so you may want to look at formatting errors.

I think the main problem is your declaration of

[LuisIntent("grettings")]
[LuisIntent("intentfr")]
public async Task Greeting(IDialogContext context, IAwaitable<IMessageActivity> activity, LuisResult result)
{
    await context.PostAsync("Welcome");

    context.Wait(MessageReceived);
}

In my experience I'd get errors when I had more than just

IDialogContext and LuisResult as the parameters for a LUIS Task. Try removing IAwaitable<IMessageActivity> activity from your parameters:

[LuisIntent("grettings")]
[LuisIntent("intentfr")]
public async Task Greeting(IDialogContext context, LuisResult result)
{
    await context.PostAsync("Welcome");

    context.Wait(MessageReceived);
}
0
votes

I had the same issue. i ended up recreating the bot and restarting my machine. worked like a charm