无法将 Microsoft Team 应用程序部署到 Azure

Unable to Deploy Microsoft Team application to Azure

总结: 尝试将用打字稿编写的 Microsoft Teams Node.JS 项目部署到 Azure 服务器时,Teams 应用程序会抛出错误“到达此应用程序时出现问题”。该应用程序在浏览器中打开时工作正常,但在 Teams 中无法识别。似乎所有清单都已正确设置,并且当 运行 在 App Studio 验证中没有返回错误。

尝试的解决方案: 尝试将清单与 Microsoft 提供的示例相匹配。尝试使用 Microsoft 共享的示例将 Microsoft 团队应用程序部署到 Azure。

代码:

Teams 应用程序清单:

{
  "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.7/MicrosoftTeams.schema.json",
  "manifestVersion": "1.7",
  "id": "dfe1fc96-d4db-4ed4-b76a-c26194928313",
  "version": "1.0.0",
  "packageName": "messageleapteams",
  "developer": {
    "name": "Real Data Consulting",
    "websiteUrl": "https://messageleapteams.azurewebsites.net",
    "privacyUrl": "https://messageleapteams.azurewebsites.net/privacy.html",
    "termsOfUseUrl": "https://messageleapteams.azurewebsites.net/tou.html"
  },
  "name": {
    "short": "messageLeapTeams",
    "full": "messageLeapTeams"
  },
  "description": {
    "short": "TODO: add short description here",
    "full": "TODO: add full description here"
  },
  "icons": {
    "outline": "icon-outline.png",
    "color": "icon-color.png"
  },
  "accentColor": "#D85028",
  "configurableTabs": [
    {
      "configurationUrl": "https://messageleapteams.azurewebsites.net/messageLeapTeamsTab/config.html?name={loginHint}&tenant={tid}&group={groupId}&theme={theme}",
      "canUpdateConfiguration": true,
      "scopes": [
        "team"
      ]
    }
  ],
  "staticTabs": [],
  "bots": [],
  "connectors": [],
  "composeExtensions": [],
  "permissions": [
    "identity",
    "messageTeamMembers"
  ],
  "validDomains": [
    "messageleapteams.azurewebsites.net"
  ],
  "showLoadingIndicator": true,
  "isFullScreen": false,
  "webApplicationInfo": {
    "id": "dfe1fc96-d4db-4ed4-b76a-c26194928313",
    "resource": "api://messageleapteams.azurewebsites.net/dfe1fc96-d4db-4ed4-b76a-c26194928313"
  }
}

我个人认为,如果你能保证你的代码没有错误,你可以检查一下你的配置。

接下来的描述都是以c# sample (conversation bot)that Ms provided. And I think nodejs为基础similar.You可以点击link查看详情

  1. 您必须使用客户端密钥创建一个 Azure Ad 应用程序,并修改 'appsetting' 文件以确保代码可以 运行 在本地。
  2. 需要 ngrok 以便您可以在本地访问您的代码 运行ning。
  3. 请在 Azure 门户上创建一个机器人,输入正确的 appId、客户端密码(在 setp 1 中创建)和消息端点(在启动 ngrok 后获取 https url,并且不要忘记附加 ' /api/messages' 在 url)
  4. 之后
  5. 现在您可以在网络聊天的本地环境中 运行ning 测试您的代码。
  6. 如果您想在 Teams 客户端中进行测试,您需要修改 'manifest.json' 并创建一个 ZIP 文件并将您的 bot 上传到 Teams。然后,您必须 在步骤 3 中创建的机器人中添加 Teams 频道 。 enter image description here

请注意,如果第 1 步中创建的 Azure AD 应用程序属于与您的 Teams 登录帐户租户不同的租户,您应该将应用程序设置为 multi-tenant app(当你创建一个应用程序时,它会要求你选择允许谁访问这个应用程序)。

如果运行在本地安装程序没有问题,deploying to azure app service后就可以了。

事实证明 Web 应用程序已正确部署并且清单已正确构建,但是对于托管在 Azure 中的团队选项卡应用程序,必须禁用加载指示器。 我通过在 manifest.json

中设置 "showLoadingIndicator": false 解决了这个问题