在AWS上发布Microsoft Bot后出现连接错误
本文关键字:连接 错误 Bot Microsoft AWS | 更新日期: 2023-09-27 18:03:06
我正试图通过visual studio 2015在AWS上发布我用c#编写的机器人。我安装了Amazon Cloud SDK,并能够成功地将bot发布到AWS。我用它提供的地址更新了bot端点(http://benbot-dev.us-west-2.elasticbeanstalk.com/)。但是当我进入微软机器人网站并测试机器人连接时,它显示无法连接到远程服务器。请帮助。我认为这是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'1's'DevPortalLib'Controllers'BotManagerController.cs:line 1420
>>>>>>>>>>>>>>>>
此异常消息告诉您,在您的服务器代码中,您正在尝试访问52.42.245.162服务器,并且该服务器不可访问(更具体地说,https端口443不可访问)。该IP解析到一些AWS主机(使用nslookup
命令查找,参见此答案)。您可以尝试ping这个IP,或者尝试查看端口80是否可访问(两者都不在我的主机上)。或者您可以尝试枚举该主机上是否有任何其他端口打开(搜索google/bing以获取如何做到这一点的说明)。如果您无法从主机访问该端口,那么Microsoft Bots网站也无法访问该端口。如果您的服务在该IP上运行,最可能的原因是您必须在AWS上打开端口才能从公共互联网访问(搜索google/bing查找aws open port
或aws allow ssh
)