botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

V3 bot getting 500 error- .net

Open rohit2912911 opened this issue 10 years ago • 10 comments

rohit2912911 avatar Jul 11 '16 05:07 rohit2912911

facing this issue in the sample code..

rohit2912911 avatar Jul 11 '16 05:07 rohit2912911

Can you provide more information such as which sample code is throwing error and stack trace of the error?

ankitbko avatar Jul 11 '16 07:07 ankitbko

public async Task Post([FromBody]Activity activity) { if (activity.Type == ActivityTypes.Message) { ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl)); // calculate something for us to return int length = (activity.Text ?? string.Empty).Length;

            // return our reply to the user
            Activity reply = activity.CreateReply($"You sent {activity.Text} which was {length} characters");
            await connector.Conversations.ReplyToActivityAsync(reply);
        }
        else
        {
            HandleSystemMessage(activity);
        }
        var response = Request.CreateResponse(HttpStatusCode.OK);
        return response;
    }

getting stack trace error on
await connector.Conversations.ReplyToActivityAsync(reply);

rohit2912911 avatar Jul 11 '16 07:07 rohit2912911

Can you post the stack trace of the error? I assume you are testing though emulator.

ankitbko avatar Jul 11 '16 08:07 ankitbko

yes i running this in emulator version 3.0.0.54.. >

while call stack I am getting this
Bot Application1.dll!Bot_Application9.MessagesController.Post(Microsoft.Bot.Connector.Activity activity) Line 30

rohit2912911 avatar Jul 11 '16 08:07 rohit2912911

Your stack trace doesn't seem to be complete. Does your web.config have the correct settings?

http://docs.botframework.com/en-us/support/upgrade-to-v3/#updates-to-the-auth-properties-in-webconfig

willportnoy avatar Jul 11 '16 20:07 willportnoy

web.config setting..tell me if something wrong in it...

<appSettings>
<!-- update these with your BotId, Microsoft App Id and your Microsoft App Password-->
<add key="BotId" value="YourBotId" />
<add key="MicrosoftAppId" value="" />
<add key="MicrosoftAppPassword" value="" />