简体   繁体   English

使用ngrok 502 Bad Getaway设置电报Bot Webhook

[英]setting up telegram bot webhook with ngrok 502 Bad Getaway

i tried to set up the bot with ngrok like the webhook sample, and this is how: 我试图像webhook示例一样使用ngrok设置机器人,这是这样的:

       using (WebApp.Start<Startup>("localhost:5229"))
        {

            Bot.Api.SetWebhook("https://sd52w84s.ngrok.io").Wait();

            Console.WriteLine("Server Started");


            Console.ReadLine();


            Bot.Api.SetWebhook().Wait();
        }

but the ngrok console log 502 Bad Getaway error, and seems like the server is not running at localhost:5229 但是ngrok控制台日志502 Bad Getaway错误,并且似乎服务器未在localhost:5229上运行

also this is the error from postman: 这也是邮递员的错误:

Failed to complete tunnel connection 无法完成隧道连接

The connection to https://sd52w84s.ngrok.io was successfully tunneled to your ngrok client, but the >client failed to establish a connection to the local address localhost:20. https://sd52w84s.ngrok.io的连接已成功通过隧道传输到您的ngrok客户端,但是> client未能建立与本地地址localhost:20的连接。

Make sure that a web service is running on localhost:5229 and that it is a valid address. 确保Web服务正在localhost:5229上运行,并且它是有效地址。

The error encountered was: dial tcp [::1]:5229: connectex: No connection could be made because the >target machine actively refused it. 遇到的错误是:Dial tcp [:: 1]:5229:connectex:由于>目标计算机主动拒绝连接,因此无法建立连接。

how can i make sure that the server is running? 我如何确保服务器正在运行? any help would be appreciated ! 任何帮助,将不胜感激 !

found the problem :| 发现问题:|

using (WebApp.Start<Startup>("localhost:5229"))

must change to 必须更改为

using (WebApp.Start<Startup>("http://localhost:5229/"))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM