当我尝试使用GetPrivateConversationData时,我得到:MicrosoftAppId的安全令牌:未经授权发布到连接器

时间:2016-07-09 15:01:44

标签: botframework

当我尝试使用此代码时:

                StateClient sc = new StateClient(new Microsoft.Bot.Connector.MicrosoftAppCredentials());
            BotData userData;
            try
            {
                userData = sc.BotState.GetPrivateConversationData(activity.ChannelId, activity.Conversation.Id, activity.From.Id);

            }
            catch (Exception ex)
            {

                throw;
            }

我收到此错误:

“MicrosoftAppId的安全令牌:未经授权发布到连接器!”

我想按照这里的指示: http://docs.botframework.com/en-us/csharp/builder/sdkreference/stateapi.html#contextualproperties

但该代码根本不会编译。方法签名不正确。

1 个答案:

答案 0 :(得分:0)

此代码似乎有效:

                StateClient sc = activity.GetStateClient();
            BotData userData = sc.BotState.GetPrivateConversationData(activity.ChannelId, activity.Conversation.Id, activity.From.Id);