我正在尝试部署最新的Microsoft Virtual Assistant code。在文档中,他们describe a process使用Visual Studio template部署和运行机器人。文档中描述的整个过程效果很好。
但是,我不喜欢使用模板。我不想失去微软的Git历史。此外,此部署还需要经受时间的考验,我想使其尽可能简单,以合并来自Microsoft的更新。
在Microsoft's repo内,有一个subdirectory,其中包含C#虚拟助手template和一个sample of the code as if it were deployed by the template。
我将描述我的解决方案,该解决方案使我可以保留Microsoft的Git历史记录,轻松进行其最新提交,并且仍为我提供了一个合理大小的项目来进行客户端的bot部署(Microsoft AI回购是巨大的,包含很多东西我不想在我的机器人程序中部署)。我正在处理的分支/项目与从Visual Studio模板中创建的解决方案/项目非常相似(见下文,看上去完全相同)。
下面是一些伪代码,大致介绍了整个过程。
$ git checkout upstream/master
Switched to branch upstream/master
Your branch is up to date with 'r_microsoft/master'.
$ git subtree split --prefix=templates/Virtual-Assistant-Template/csharp/sample --onto upstream/virtual-assistant-csharp -b upstream/virtual-assistant-csharp
$ git checkout upstream/virtual-assistant-csharp
$ git checkout -b eric/develop
Switched to branch 'eric/develop'
Your branch is up to date with 'r_eric/develop'.
$ git rebase upstream/virtual-assistant-csharp
Current branch eric/develop is up to date.
使用这个子树而不是从模板创建的解决方案,我遵循directions进行部署和运行机器人。微软有一个separate Markdown page for the deployment(如果您想签出该链接,则为链接)。
部署似乎已成功运行。我用xxx
替换了敏感信息。
PS C:\Users\eric\bot\VirtualAssistantSample> .\Deployment\Scripts\deploy.ps1 -name "personal-bot-test-using-git" -location "westus" -luisAuthoringKey "xxx" -luisAuthoringRegion "westus" -resourceGroup "personal-bot-test-using-git" -appId "xxx" -appPassword "xxx"
> Creating resource group ...
> Deploying Azure services (this could take a while)...
> Updating appsettings.json ...
> Deploying cognitive models ...
> Initializing dispatch model ...
> Parsing general LU file ...
> Deploying general LUIS app ...
> Adding general app to dispatch model ...
> Parsing chitchat LU file ...
> Deploying chitchat QnA kb ...
> Adding chitchat kb to dispatch model ...
> Parsing faq LU file ...
> Deploying faq QnA kb ...
> Adding faq kb to dispatch model ...
> Creating dispatch model...
> Done.
我完全按照他们的步骤进行了所有操作(除了不使用模板外)。当我建立时,没有错误。运行该机器人不会显示任何错误。
这是我使用Microsoft's Bot Emulator(替换为敏感值)进行的连接。
但是,当我测试机器人时,没有骰子。它不会显示欢迎消息。
通信无法正常工作。
。
这就是POST 400 Directline.postActivity所说的。
{
"error": {
"code": "ServiceError",
"message": "Refresh access token failed with status code: 401"
}
}
另一方面,如果我执行所有相同的步骤,除了从模板创建的项目/解决方案开始,它就可以正常工作。
。
答案 0 :(得分:1)
@EricHansen和我在his related GitHub Issue中进行了交谈。由于这些信息可能对其他人有价值,因此我将在此处添加“答案”:
401几乎总是由不匹配的MicrosoftAppId
/ MicrosoftAppPassword
引起的。确保它们在所有这些位置都匹配:
appsettings.json
/ .env
/ .bot
,只要适用如果这不起作用,请遵循Authentication Troubleshooting Guide
您还应该确保所有软件包都是最新的,包括:
OP分辨率最可能与此有关:
我肯定遇到了一些密码字符串的问题。 The README指出使用包含
@
的密码有麻烦。我知道我已经 遇到其他密码的问题,但是(我不记得了 特殊字符给了这个问题)。我想这就是 问题。我最好的猜测是这是一个有特殊字符的问题 使用密码,模拟器以某种意外的方式缓存ID /或IIS 以某种方式表示缓存ID /传递。通常,如果我要切换机器人 具有相同的端点并遇到麻烦,我重新启动它们,然后 通常可以正常工作。