Keep Alive not working

2 个月 前
Hi,

I've had a search through the threads and I have seen multiple people have this issue, but I couldn't find a resolution for myself.

I am using IONOS Hosting, this is the error I get when I try to manually run Keep Alive:
One or more errors occurred. (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.)


I am also having issues with sending test emails but think the issues may be related so was hoping to resolve this one first.

Here is my error log:

System.AggregateException: One or more errors occurred. (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.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 System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
   at System.Net.Http.HttpClient.GetStringAsyncCore(Task`1 getTask)
   at Nop.Services.Common.StoreHttpClient.KeepAliveAsync() in C:\andrei\nop_sources\src\Libraries\Nop.Services\Common\StoreHttpClient.cs:line 40
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at Nop.Services.Common.KeepAliveTask.Execute() in C:\andrei\nop_sources\src\Libraries\Nop.Services\Common\KeepAliveTask.cs:line 33
   at Nop.Services.Tasks.Task.ExecuteTask() in C:\andrei\nop_sources\src\Libraries\Nop.Services\Tasks\Task.cs:line 83
   at Nop.Core.Caching.MemoryCacheManager.PerformActionWithLock(String key, TimeSpan expirationTime, Action action) in C:\andrei\nop_sources\src\Libraries\Nop.Core\Caching\MemoryCacheManager.cs:line 178
   at Nop.Services.Tasks.Task.Execute(Boolean throwException, Boolean ensureRunOncePerPeriod) in C:\andrei\nop_sources\src\Libraries\Nop.Services\Tasks\Task.cs:line 165


The store URL is https://www.BearBargains.co.uk I did notice when i try to ping that URL i get a 50% packet loss, however when I ping the IP no issues at all.

Thank you for your time!
2 个月 前
See if this helps
https://www.nopcommerce.com/en/boards/topic/85201/error-whith-the-keep-alive-schedule-task
2 个月 前
New York wrote:

I believe it is a similar issue, I created a simple PHP script to ping my domain from the hosting and it also fails, the hosting I'm using is IONOS I'm trying to contact them to understand a workaround, or the internal address, but still waiting to hear back.
2 个月 前
What happens when you go to this page (in your site) in a browser:
https://demo.nopcommerce.com/keepalive
2 个月 前
It says I’m alive you can see for yourself @
www.bearbargains.co.uk/keepalive
2 个月 前
Okay so I believe it is all working now for the first time I am seeing a 'Last Success Date' so I wanted to conclude this post and show anyone else having similar issues what I did to fix it! THIS IS ESSENTIALLY JUST TO MAKE PROXY WORK ON 4.30 ON IONOS (might work for other hosting providers but the proxy settings will differ)

So first of all:
Navigate to your admin section / backend > Settings > All Settings (Advanced)
Once on this page in the search bar and search for proxy

NOTE: SET 'PROXYSETTINGS.ENABLED' LAST OTHERWISE YOUR BACKEND WILL STOP WORKING
Assign these values to the following setting names:
proxysettings.address = http://winproxy.server.lan
proxysettings.bypassonlocal = True
proxysettings.port = True
proxysettings.preauthenticate = True
proxysettings.enabled = True

proxy settings.username and password  can remain blank as we do not need them for this particular proxy.

When I reloaded I got a code error which I resolved from another forum post the solution is to open up the source code in VS navigate to 'ServiceCollectionExtensions.cs' and as of writing this on line 404 we have this bit of code
services.AddHttpClient<StoreHttpClient>();

All we need to do is modify this to
services.AddHttpClient<StoreHttpClient>().WithProxy();


I then publish Nop.Web, uploaded the files to my hosting, and this time when I tried to run the Keep Alive task I was given a https error and proxy is configured for http.

So I go to the admin section / backend and navigate to Configuration > Stores > and changed my store name from https://yourstorename.com to http://yourstorename.com

Now it all works exactly as expected, I really hope someone else finds this useful because I've been struggling on this for a couple of days with no external debugging.
2 周 前
I was having an issue with Keep Alive and other scheduled task not working on my local server. I got my problem corrected by adding a DNS record on the local router that points the URL to the server that is hosting the site. For example....  www.hostname.com   to  192.168.1.40