botframework-sdk: 500 Internal Server Error in emulator - V3
I’ve recently upgraded my bot to the new V3 bot framework, and since then I’ve been getting 500 InternalServerErrors in the emulator and the “sorry, the bot is having trouble responding” messages in Slack, breakpoints anywhere in the method below don’t get triggered at all so I can’t really get a stack trace.
public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
{
if (activity.Type == ActivityTypes.Message)
{
ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl));
// return our reply to the user
Activity reply = activity.CreateReply("hello world");
await connector.Conversations.ReplyToActivityAsync(reply);
}
else
{
HandleSystemMessage(activity);
}
var response = Request.CreateResponse(HttpStatusCode.OK);
return response;
}
This code is the default VS template code, with the correct Web.config settings.
Below is what appears in the log when testing the connection to the bot:
InternalServerError
{
"message": "An error has occurred.",
"exceptionMessage": "Could not load type 'System.IdentityModel.Tokens.TokenValidationParameters' from assembly 'System.IdentityModel.Tokens.Jwt, Version=5.0.0.127, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.",
"exceptionType": "System.TypeLoadException",
"stackTrace": " at Microsoft.Bot.Connector.BotAuthentication.<OnAuthorizationAsync>d__16.MoveNext()\r\n at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)\r\n at Microsoft.Bot.Connector.BotAuthentication.OnAuthorizationAsync(HttpActionContext actionContext, CancellationToken cancellationToken)\r\n at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"
}
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 54 (17 by maintainers)
I uninstalled packages from NuGet, deleted “bin”, “obj” and “packages”, re-added everything and now the 500 error is gone, but the 401 still persists:
Microsoft.Bot.Builder = 3.0.1 System.IdentityModel.Tokens.Jwt = 4.0.2.206221351
@msft-shahins I tried only updating the bot builder package, but then I get this: