使用:
在Bot Framework Emulator V4中测试该机器人时,它的确按预期工作,如下图所示:
按照this的说明将其部署到Azure后,机器人停止工作(发送或接收消息),并在网络聊天频道部分收到此警报:
我发现了这些类似的问题:
https://github.com/Microsoft/BotFramework-Emulator/issues/296
https://github.com/Microsoft/BotBuilder/issues/3329
但是在我的案例中,同时定义了AppId和Password,而另一个解决方案根本不起作用。 我什至设法在azure平台上找到错误代码,但我无法找到详细信息或错误的来源...
public async Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken = default(CancellationToken))
{
bool reintentar = false;
//tried this but didn't work
//MicrosoftAppCredentials.TrustServiceUrl("http://botrps.azurewebsites.net");
//obtener el contexto de los dialogos
var dc = await _dialogs.CreateContextAsync(turnContext, cancellationToken);
if (turnContext.Activity.Type == ActivityTypes.Message && turnContext.Activity.From.Id != turnContext.Activity.Recipient.Id)
{
//bot operations on users messages
}
//if active dialog
await dc.ContinueDialogAsync(cancellationToken);
//else, start greeting dialog
if (turnContext.Activity.Type == ActivityTypes.ConversationUpdate &&
turnContext.Activity.MembersAdded[0].Id != turnContext.Activity.Recipient.Id)
{
await dc.BeginDialogAsync("dialogo", null, cancellationToken);
}
await _accessors.ConversationState.SaveChangesAsync(turnContext, false, cancellationToken);
// Guarda los cambios realizados en el Contexto, si hay alguno
await _accessors.UserState.SaveChangesAsync(turnContext, false, cancellationToken);
}
答案 0 :(得分:0)
正如tdurnford在评论部分所述,有必要将生产委托服务添加到.bot配置中。生成的bot文件:
{
"name": "BotMod2",
"services": [
{
"type": "endpoint",
"name": "development",
"endpoint": "http://localhost:3978/api/messages",
"appId": "",
"appPassword": "",
"id": "1"
},
{
"appId": "**********************",
"appPassword": "**********************",
"endpoint": "https://**********************.azurewebsites.net/api/messages",
"type": "endpoint",
"name": "production",
"id": "2"
},
{
"appId": "**********************",
"authoringKey": "**********************",
"version": "0.1",
"region": "westus",
"type": "luis",
"name": "**********************",
"id": "3"
},
{
"type": "qna",
"name": "**********************",
"kbId": "**********************",
"hostname": "https://**********************.azurewebsites.net/qnamaker",
"endpointKey": "**********************",
"subscriptionKey": "**********************",
"id": "4"
}
],
"padlock": "",
"version": "2.0"
}