无法反序列化响应-GetUserDataAsync [英] Unable to deserialize the response - GetUserDataAsync
问题描述
我正在使用机器人技术,在我的一个项目中,我使用了bot状态概念来获取bot数据并在此处设置新数据,如下所示,我使用了状态客户端对象
I am working bot technology, in one of my project I used bot state concept to get the bot data and set new data here I used state client object like this below
//var stateClient = new StateClient(new Uri("http://localhost:9000/"));
var stateClient = new StateClient(new Uri("https://skype.botframework.com"));
这是我在LoginController.cs中编写的代码
This is code I wrote in LoginController.cs
if (stateClient != null)
{
var getData = await stateClient.BotState.GetUserDataAsync(Constants.Constants.botId, activity.From.Id);// 29:1_12CsCTqilHlQTG9KI8YmvCKd - zwzekm2IDKR7xN8EVE3gjtfNQYp1aOzuC9Rs_t
//var getData = await client.B.GetUserDataAsync(Constants.Constants.botId, userid);
getData.Data = ar.Serialize();
var foo = await stateClient.BotState.SetUserDataAsync(Constants.Constants.botId, activity.From.Id, getData);
//var foo = await client.Bots.SetUserDataAsync(Constants.Constants.botId, userid, getData);
}
以上代码将毫无例外地在bot模拟器中成功运行.但是,当我将机器人添加到Skype然后开始聊天时,执行此行后,我得到了异常无法反序列化响应"
The above code will work in bot emulator successfully without exception. but when I added bot to skype then started to chat at that time I am getting exception 'Unable to deserialize the response' after executed this line
var getData = await stateClient.BotState.GetUserDataAsync(Constants.Constants.botId, activity.From.Id);
请告诉我如何解决.
推荐答案
您可能需要使用 https://state.botframework .com 作为StateClient的终结点,而不是skype.botframework.com.
You might need to use https://state.botframework.com as the endpoint for the StateClient rather than skype.botframework.com.
这篇关于无法反序列化响应-GetUserDataAsync的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!