I have created Telegram bot via webhook and ngrok. It works when launching inside VS. But when I have published to local IIS, request to site ends with "500 HTTP ERROR" and system events viewer shows that exception occurred when calling IHost.Run() method.
Description: The process was terminated due to an unhandled exception. Exception info: System.Net.Http.HttpRequestException: 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. ---> System.Net.Sockets.SocketException (10060): 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. ... at Telegram.Bot.TelegramBotClient.MakeRequestAsync[TResponse](IRequest`1 request, CancellationToken cancellationToken) ... at TemperatureBot.Program.Main(String[] args) in C:\Users\administrator\source\repos\TemperatureBot\TemperatureBot\Program.cs:line 14
On Run() method one of hosted services performs this:
botClient.SetWebhookAsync(hook);
Internet is accessed through corporative proxy.
Why it works well in VS debug but blunders on IIS?
CodePudding user response:
Changed default publishing directory (/bin/Release/netcoreapp3.1/publish) to custom, and everything works