2016-08-18 24 views
0

我試圖發佈一個bot,我用C#通過visual studio 2015編碼到AWS。我安裝了Amazon Cloud SDK,並能夠成功將bot發佈到AWS。我用它給的地址更新了bot端點(http://benbot-dev.us-west-2.elasticbeanstalk.com/)。但是當我去微軟Bots站點並測試機器人連接時,它說無法連接到遠程服務器。請幫忙。我認爲這是https端點問題。但是我不確定如何獲得API網關端點。微軟機器人在AWS上發佈後出現連接錯誤

<<<<<<<<<< 
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 
>>>>>>>>>>>>>>>> 
+0

可以從您的本地「ping」主機達到52.42.245.162?如果是,您是否可以嘗試從AWS服務執行相同的操作? – oldbam

+0

嗨@oldbam。發送幫助。不,我無法ping通。請求超時。我在想t意味着這個機器人已經發布了,但它沒有鏈接到某些API服務?或類似的東西,它有一個消息端點,可以發送和接收消息。但我不知道這是如何在AWS中完成的。他們讓它變得如此複雜。 –

回答

0

此異常消息告訴你,你的服務器代碼中你想在52.42.245.162到達服務器,該服務器無法訪問(更具體地說,HTTPS端口443不可訪問)。該IP解析爲某個AWS主機(使用nslookup命令查找,請參閱this answer)。您可以嘗試ping此IP,或嘗試查看端口80是否可訪問(兩者不是來自我的主機)。或者您可以嘗試枚舉該主機上是否有其他端口打開(搜索google/bing以獲取有關如何執行此操作的說明)。如果您無法通過主機訪問該端口,則Microsoft Bots站點也無法訪問該端口。如果您的服務在該IP上運行,最可能的原因是您必須打開AWS上的端口才能通過公共互聯網訪問(搜索google/bing爲aws open portaws allow ssh

+0

非常感謝。經過大量的閱讀,所以我試圖打開beanstalk環境中的443端口,並要求提供SSL證書。我正嘗試從AWS Certificate Manager控制檯請求新的SSL證書,並要求提供一個網站。現在我不明白我應該給哪個網站。機器人的網址?它不會採取這個地址,因爲沒有亞馬遜網站可以作爲網站在那裏。那麼應該給哪個網站。我沒有任何網站。 我只是想在AWS雲上發佈一個殭屍工具,但是AWS中這個複雜的步驟真的很難。 –

+0

當導航到端口443時,在該端口偵聽的Web服務器會顯示證實其身份的證書。把它看作是某個權威機構頒發的護照。您可能正在討論您嘗試獲取有效證書的AWS託管服務。在這種情況下,它將成爲託管服務的地址 – oldbam