在 AWS 上发布 Microsoft Bot 后出现连接错误

Connection Error on Microsoft Bot after publishing it on AWS

我正在尝试将我在 visual studio 2015 年之前用 C# 编码的机器人发布到 AWS。我安装了 Amazon Cloud SDK 并成功将机器人发布到 AWS。我用它提供的地址更新了机器人端点 (http://benbot-dev.us-west-2.elasticbeanstalk.com/)。但是,当我访问 Microsoft Bots 站点并测试机器人连接时,它显示无法连接到远程服务器。请帮忙。我认为这是 https 端点问题。但是我不确定如何获得 API 网关端点(如果需要的话)。

<<<<<<<<<<
500 InternalServerError
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 52.42.245.162:443
   at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context)
   at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar)
   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Intercom.DevPortal.Server.Controllers.BotManagerController.<PingV3BotAsync>d__54.MoveNext() in C:\a\s\DevPortalLib\Controllers\BotManagerController.cs:line 1420
>>>>>>>>>>>>>>>>

此异常消息告诉您,在您的服务器代码中,您正试图访问位于 52.42.245.162 的服务器,但该服务器不可访问(更具体地说,https 端口 443 不可访问)。此 IP 解析为某个 AWS 主机(使用 nslookup 命令找出它,请参阅 this answer)。您可以尝试 ping 这个 IP,或者尝试查看端口 80 是否可以访问(两者都不是来自我的主机)。或者您可以尝试枚举该主机上是否打开了任何其他端口(搜索 google/bing 以获取如何操作的说明)。如果您无法从主机访问该端口,则 Microsoft Bots 站点也无法访问它。如果您的服务在该 IP 上 运行,最可能的原因是您必须打开 AWS 上的端口才能从 public 互联网访问(在 google/bing 中搜索 aws open portaws allow ssh)