我正在使用Azure Enterprise订阅并使用相同的方式创建了一个聊天机器人。但目前,我在使用它聊天时遇到了麻烦。僵尸程序是使用Visual Studio使用Bot框架创建的,并发布到Azure。 https://pihitsupportbot001.azurewebsites.net/是我的消息传递端点URL。我为同一个应用程序进行了bot通道注册,并使用api / messages作为端点的bot api端点。使用生成的应用程序ID和密码更新了Web配置文件并发布。但是,当我尝试使用Azure中的网络聊天进行测试时,它会抛出“无法发送重试”。那是什么原因?
Jobin,我能够将机器人模拟器从我的本地PC连接到您的终端,https://pihitsupportbot001.azurewebsites.net/api/message,显然没有你的appid和app密码。我发了一封'你好'并收到了一张登录卡回复。因此,机器人似乎工作正常。编辑web.config后,应用程序服务是否仍在重新启动?此外,用有限的信息帮助诊断这些问题非常困难。
该错误是由于在global.asax中我没有指定任何状态来存储对话历史记录的原因。早些时候,微软一直在为使用Node.js或.NET SDK构建的僵尸程序提供默认状态服务。状态服务用于在对话的上下文中存储和检索用户和对话数据。但实际上在使用模拟器或甚至在IIS中运行的本地时,它不需要它。以下是文档。
Bot State Service will soon be retired on March 31st, 2018
var store = new TableBotDataStore(ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString);
Conversation.UpdateContainer(
builder =>
{
builder.Register(c => store)
.Keyed<IBotDataStore<BotData>>(AzureModule.Key_DataStore)
.AsSelf()
.SingleInstance();
builder.Register(c => new CachingBotDataStore(store,
CachingBotDataStoreConsistencyPolicy
.ETagBasedConsistency))
.As<IBotDataStore<BotData>>()
.AsSelf()
.InstancePerLifetimeScope();
});