Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Arlan Galvez 44 posts 175 karma points
    Jun 11, 2018 @ 20:02
    Arlan Galvez
    1

    ERROR Umbraco.Web.Scheduling.KeepAlive - Failed (at "https://localhost/umbraco")

    Hello, I'm getting this issue too frequent on my Umbraco logs but I cannot find the real issue. This error repeats every 5 min (as you can see on the code). I'm working with Umbraco 7.6.3 hosted on a scaled out Azure Web App. I have custom UrlRewrites on my web.config

    <rule name="Enforce https" enabled="true" stopProcessing="true">
          <match url="(.*)" />
          <conditions logicalGrouping="MatchAll">
            <add input="{HTTPS}" pattern="off" />
            <add input="{HTTP_HOST}" matchType="Pattern" pattern="^localhost*" negate="true" />
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
        </rule>
    

    Can this rewrites screw the schedule publish of umbraco? This are the errors:

    2018-06-09 14:36:22,195 [P4232/D2/T108] ERROR Umbraco.Web.Scheduling.KeepAlive - Failed (at "https://localhost/umbraco").
    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: An attempt was made to access a socket in a way forbidden by its access permissions 127.0.0.1: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.EndGetResponse(IAsyncResult asyncResult)
       at System.Net.Http.HttpClientHandler.GetResponseCallback(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 Umbraco.Web.Scheduling.KeepAlive.<PerformRunAsync>d__4.MoveNext()
     2018-06-09 14:41:22,211 [P4232/D2/T40] ERROR Umbraco.Web.Scheduling.KeepAlive - Failed (at "https://localhost/umbraco").
    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: An attempt was made to access a socket in a way forbidden by its access permissions 127.0.0.1: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.EndGetResponse(IAsyncResult asyncResult)
       at System.Net.Http.HttpClientHandler.GetResponseCallback(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 Umbraco.Web.Scheduling.KeepAlive.<PerformRunAsync>d__4.MoveNext()
    
  • Andy Felton 185 posts 484 karma points c-trib
    Jun 12, 2018 @ 07:17
    Andy Felton
    102

    Hi Arlan,

    Yes this can be an issue. Umbraco works be determining the connection it can use to communicate server side. Looking at your error message the URL it's trying to connect to is https://localhost/umbraco which is suspect you can't connect to from the server.

    Can you check if umbracoUseSSL is set to true in the web.config as this may help. If you still have trouble after this you can hardcode the server side URL by setting umbracoApplicationUrl="http://localhost/umbraco" in config/umbracoSettings.config.

    Hope that helps. Andy

  • Arlan Galvez 44 posts 175 karma points
    Jun 12, 2018 @ 14:38
    Arlan Galvez
    0

    Hello Andy, Thank you for your answer. I have umbracoUseSSL on true at the moment I post the issue. I will try with the umbracoApplicationUrl="https://localhost/umbraco" but I have a question here: Do I need to use http or https on the url?

  • Andy Felton 185 posts 484 karma points c-trib
    Jun 12, 2018 @ 14:49
    Andy Felton
    1

    Hi Arlan,

    I would try it without the https.

    Thanks Andy

  • Nadine Fisch 159 posts 429 karma points
    Oct 04, 2018 @ 07:58
    Nadine Fisch
    0

    Hi,

    I get the same error, but the proposed solution by setting umbracoApplicationUrl="http://localhost/umbraco" in config/umbracoSettings.config doesn't work for me. The error still appears every 2 minutes.

    We are working with Umbraco 7.5.4 assembly: 1.0.6136.27241

    Best regards, Nadine

  • Nadine Fisch 159 posts 429 karma points
    Oct 04, 2018 @ 08:31
    Nadine Fisch
    1

    I changed localhost to the sitename. Now it seems to be away.

  • Eric Schrepel 161 posts 226 karma points
    Jun 26, 2019 @ 18:52
    Eric Schrepel
    0

    On our Umbraco 8 site, I've tried the above (changing the web.routing line in umbracoSettings so that the umbracoApplicationUrl="https://ourwebsitename/umbraco"), but still getting the keepalive errors every 5 minutes. I also read it could be a TLS thing but we have TLS 1.0 and 1.1 turned off on our Windows 10 server. I've read about adding this line somewhere, not sure where it goes: System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12

    Anyone have any more luck with this?

  • Bryna 74 posts 260 karma points
    Jun 26, 2019 @ 19:05
    Bryna
    0

    You have to make a composition something like below:

     public class MyComponent : IComponent
        {
            public void Initialize()
            {
                System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
            }
    }
    

    I think it is also covered more exhaustively at https://our.umbraco.com/documentation/Implementation/Composing/

  • Ahmed Ramadan 10 posts 100 karma points
    Feb 13, 2020 @ 12:35
    Ahmed Ramadan
    0

    I have umbraco version 7.14.0 and have a same problem with a subdomain

    2020-02-13 00:08:42,607 [P9100/D2/T23] ERROR Umbraco.Web.Scheduling.KeepAlive - Failed (at "http://subdomain.domain.com/umbraco"). System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host.

    Could any one help me please?.

  • Lars Peter Larsen 3 posts 73 karma points
    Jun 10, 2020 @ 10:44
    Lars Peter Larsen
    0

    This is due to the server running the Umbraco-site requiring TLS 1.2 connections (Azure App Services for instance).

    It can be fixed by setting ServicePointManager.SecurityProtocal globally for the Umbraco site, by overriding ApplicationStarted in a class inheriting from ApplicationEventHandler. For instance:

    public class RegisterEvents : ApplicationEventHandler
    {
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            // Fix "Umbraco.Web.Scheduling.KeepAlive Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host."
            if (ServicePointManager.SecurityProtocol.HasFlag(SecurityProtocolType.Tls12) == false)
                ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
        }
    }
    
  • Eric Schrepel 161 posts 226 karma points
    Jun 10, 2020 @ 17:12
    Eric Schrepel
    0

    For our Umbraco 8.6.2 environment, only TLS 1.2 is enabled using similar code, still have the KeepAlive errors. Viewing the log, the every-5-minutes KeepAlive error reads as follows:

    System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
       at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
       at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
       --- End of inner exception stack trace ---
       at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
       at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
       --- End of inner exception stack trace ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Umbraco.Web.Scheduling.KeepAlive.<PerformRunAsync>d__5.MoveNext() in D:\a\1\s\src\Umbraco.Web\Scheduling\KeepAlive.cs:line 69
    
  • Lars Peter Larsen 3 posts 73 karma points
    Jun 10, 2020 @ 18:49
    Lars Peter Larsen
    0

    Sounds like a self-issued or expired SSL-certificate. Or maybe the common name does not match the hostname?

    You should be able to ignore the error by:

    ServicePointManager.ServerCertificateValidationCallback += (o, c, ch, er) => true;

    Beware that this also will ignore certificate errors for all other sites that you make calls to. Might not be that big an issue, since you have complete control of who and what you make http requests to 😉

  • Niels Swimberghe 22 posts 105 karma points c-trib
    Sep 15, 2020 @ 15:49
    Niels Swimberghe
    1

    If you're using Azure App Services, the service has a built-in "Always On" mode which achieves the same goal. Since Umbraco 8.6 you can disable the keepAlive task if you'd wish to. The configuration can be found in umbracoSettings.config:

    <?xml version="1.0" encoding="utf-8" ?>
    <settings>
      ...
      <!--
      keepAlive
        @disableKeepAliveTask
          Disables the periodic KeepAliveTask when set to "true".
          Use this setting to disable the KeepAliveTask in case you already have an alternative.
          For example, Azure App Service has keep alive functionality built-in.
          Defaults to "false".
        @keepAlivePingUrl
          The url of the KeepAlivePing action. By default, the url will use the umbracoApplicationUrl setting as the basis.
          Change this setting to specify an alternative url to reach the KeepAlivePing action. eg http://localhost/api/keepalive/ping
          Defaults to "{umbracoApplicationUrl}/api/keepalive/ping".
      -->
      <keepAlive disableKeepAliveTask="true" keepAlivePingUrl="{umbracoApplicationUrl}/api/keepalive/ping" />
    </settings>
    

    Last time I tried connecting to localhost on App Services, it denied on both HTTP/80 and HTTPS/443. I don't think the service allows you to do that. This is from Azure Web App sandbox docs:

    Rejected connection attempts, such as the following example which attempts to connect to 127.0.0.1:80, from .NET will result in the following exception: Exception Details: System.Net.Sockets.SocketException: An attempt was made to access a socket in a way forbidden by its access permissions 127.0.0.1:80

    I ended up disabling the keepAlive task and enabled "Always On". I ended up writing a blog post on the keep alive configuration here: https://swimburger.net/blog/umbraco/introducing-umbracos-keepalive-ping-configuration

    Hope it helps!

Please Sign in or register to post replies

Write your reply to:

Draft