2017-04-04 26 views
0

我試圖通過狀態客戶端保存對話數據,並且模擬器和短信通道之間的結果不一致。通過模擬器進行測試我的機器人應用程序允許我SetConversationData和GetConversationData細,但只要我嘗試與服務URL的短信:https://sms.botframework.com/我收到以下錯誤:Botstate.SetConversationData - 解析值時遇到意外的字符

"exceptionMessage": "Unable to deserialize the response.", "exceptionType": "Microsoft.Rest.SerializationException", "stackTrace": " at Microsoft.Bot.Connector.BotState.d__9.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 Microsoft.Bot.Connector.BotStateExtensions.d__9.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 Microsoft.Bot.Connector.BotStateExtensions.SetConversationData(IBotState operations, String channelId, String conversationId, BotData botData)\r\n at OutboundTestApp.Controllers.OutboundController.Post(OutboundConversationData`1 outboundData)", "innerException": { "message": "An error has occurred.", "exceptionMessage": "Unexpected character encountered while parsing value: T. Path '', line 0, position 0.", "exceptionType": "Newtonsoft.Json.JsonReaderException", "stackTrace": " at Newtonsoft.Json.JsonTextReader.ParseValue()\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, JsonContract contract, Boolean hasConverter)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)\r\n at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)\r\n at Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject[T](String json, JsonSerializerSettings settings)\r\n at Microsoft.Bot.Connector.BotState.d__9.MoveNext()"

這裏是我的代碼來設置數據,其中該渠道ID是「短信」,是的conversationId有效身份證件和數據僅僅是一個簡單的POCO類:

var stateClient = new StateClient(new Uri(serviceUrl), account); 
    stateClient.BotState.SetConversationData(outboundData.ChannelId, conversationResponse.Id, new BotData(data: outboundData.Data)); 

我應該使用SetPrivateConversationDataWithHttpMessagesAsync並通過在內容類型和我botdata設置爲一個JSON字符串?我覺得狀態客戶端假設json被傳遞到某個地方,但它反序列化的對象實際上不是json。

回答

相關問題