C# Bot框架通道仿真器的通道ID无效?
我正在使用C Bot框架库从Bot状态服务中检索一些数据。在下面的代码中,每当channelId==emulator时,它都会失败,请求错误为400。看起来Emulator版本3.0.0.59和3.5.27都使用此通道ID。以下是返回的有效负载:C# Bot框架通道仿真器的通道ID无效?,c#,botframework,C#,Botframework,我正在使用C Bot框架库从Bot状态服务中检索一些数据。在下面的代码中,每当channelId==emulator时,它都会失败,请求错误为400。看起来Emulator版本3.0.0.59和3.5.27都使用此通道ID。以下是返回的有效负载: { "error": { "code": "BadArgument", "message": "Invalid channel ID" } } 请注意,如果我将channelId更改为其他类似skype的内容,它将按预期工作
{
"error": {
"code": "BadArgument",
"message": "Invalid channel ID"
}
}
请注意,如果我将channelId更改为其他类似skype的内容,它将按预期工作
var credentials = new MicrosoftAppCredentials(id, password);
this.botState = new BotState(new StateClient(credentials));
var channelId = activity.ChannelId;
await botState.GetUserDataAsync(channelId, activity.From.Id);
来自Bot框架团队:
对于emulator,他们需要在创建状态客户端时使用活动的serviceurl。生成器会在连接器客户端工厂中自动执行此操作:
该错误来自state.botframework.com,它是stateclient的默认端点,因为emulator不是状态服务的有效channelid
if (IsEmulator(this.address))
{
// for emulator we should use serviceUri of the emulator for storage
return new StateClient(this.serviceUri, this.credentials);
}