问题描述
我在Telegram中有一个机器人,并试图在Plesk Host中运行它(在端口443上具有SSL)
当我在Visual Studio中运行机器人页面时,该机器人运行良好。 将项目发布/上传到plesk主机并打开机器人页面后,该机器人也运行良好
但是在设置了Webhook之后,该机器人无法运行。 在webhookInfo中1.6分钟后,我得到以下信息:
{
"ok":true,"result":{
"url":"https://MYDOMAIN:443/Robot.aspx","has_custom_certificate":false,"pending_update_count":1,"last_error_date":1598521211,"last_error_message":"Read timeout expired","max_connections":40
}
}
我的源代码:
public class Robot : Page
{
private const string Token = "1257942485:AAFMeYMX187lEeN8XHCEtSyCVoXXXX";
private HttpToSocks5Proxy proxy = new HttpToSocks5Proxy(
socks5Hostname: "so5tel.XXXX.org",socks5Port: 6500,username: "XXXX",password: "XXXX"
);
private static ITelegramBotClient _botClient;
protected void Page_Load(object sender,EventArgs e)
{
proxy.ResolveHostnamesLocally = true;
RegisterasyncTask(new PageAsyncTask(RunBot));
ExecuteRegisteredAsyncTasks();
}
private async Task RunBot()
{
_botClient = new TelegramBotClient(Token,proxy);
_botClient.OnMessage += Bot_OnMsgAsync;
_botClient.OnReceiveError += _botClient_OnReceiveError;
_botClient.StartReceiving();
}
async void Bot_OnMsgAsync(object sender,MessageEventArgs e)
{
await _botClient.SendTextMessageAsync(e.Message.Chat.Id,e.Message.Text).ConfigureAwait(false);
}
private void _botClient_OnReceiveError(object sender,ReceiveErrorEventArgs e)
{
using (StreamWriter we = new StreamWriter(Server.MapPath("file.txt"),true))
{
we.WriteLine(e.ApiRequestException.Message + DateTime.Now);
}
}
}
在file.txt中,我得到以下信息:
Conflict: can't use getUpdates method while webhook is active; use deleteWebhook to delete the webhook first
我该如何解决?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)