Copied to clipboard

Flag this post as spam?

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


  • Kieron McIntyre 116 posts 359 karma points
    Nov 06, 2017 @ 13:27
    Kieron McIntyre
    0

    KeepAlive calling incorrect domains

    We have a site that is deployed to Azure and the log files have been filling with a particular error message:

    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.

    This same error is also being thrown showing other domains too including a colleague's local IIS binding.

    I have checked the [umbracoServer] and I can see records matching the erroring domains and if I delete these, they are recreated automatically by Umbraco.

    As far as I can see from stepping through Umbraco's source, this is happening because Umbraco's application context thinks that the application's domain is localhost (or whatever). The ApplicationContext delegates the job of determining the URL/domain to ApplicationUrlHelper.EnsureApplicationUrl().

    So, the domain used in KeepAlive is determined from the following steps, in order:

    • umbracoSettings:settings/web.routing/@umbracoApplicationUrl - This is not set in our project
    • umbracoSettings:settings/scheduledTasks/@baseUrl - This is not set
    • Server registrar - We have no distributedCall servers configured
    • Custom URL provider - We have no custom URL provider configured
    • From current request

    In our case the domain must be being determined by the current request but if this is the case, why is this picking up incorrect domains?

    Why is Umbraco automatically populating the umbracoServer table with incorrect hosts when we have no distributedCall servers configured?

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Nov 06, 2017 @ 13:57
    Dave Woestenborghs
    0

    Hi Kieron,

    I see it's trying to access https://localhost

    Do you have configured umbraco to run under SSL ?

    Dave

  • Kieron McIntyre 116 posts 359 karma points
    Nov 06, 2017 @ 14:28
    Kieron McIntyre
    0

    Hi Dave, yes I have. Both locally and in production.

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Nov 06, 2017 @ 14:38
    Dave Woestenborghs
    0

    Hi Kieron,

    Have you tried setting the Umbraco applicatoin url : https://our.umbraco.org/documentation/Reference/Config/umbracoSettings/#web-routing

    And this setting in web.config set to true ?

    https://our.umbraco.org/documentation/Reference/Config/webconfig/#umbracousessl

    And out of curiosity. What kind of certificate do you use on your local machine ?

    Dave

  • Kieron McIntyre 116 posts 359 karma points
    Nov 06, 2017 @ 14:43
    Kieron McIntyre
    0

    The site already is configured to umbracoUseSSL = true and I'm quite certain that the issue isn't SSL related.

    Wrt the web-routing setting, I wanted to avoid setting anything I needn't. I don't usually have to set this (I can't actually remember having to set this) so I'd rather keep the project as is and figure out what the issue/cause is without masking it.

    Locally I self cert but have the cert installed in trusted certs which gets over a few hurdles.

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Nov 06, 2017 @ 14:59
    Dave Woestenborghs
    0

    Do you also access the site using localhost as domain ?

    Dave

  • Kieron McIntyre 116 posts 359 karma points
    Nov 06, 2017 @ 15:04
    Kieron McIntyre
    0

    That's the thing, we don't. If we did, that would certainly explain it.

  • Dan Patching 31 posts 158 karma points c-trib
    Nov 06, 2017 @ 15:46
    Dan Patching
    1

    Hi Kieron,

    I had a similar issue to this with a site, I have behind Cloudflare CDN.

    The problem was because Cloudflare were providing the SSL connection on their proxy, but I had no certificate installed on the server. So it was effectively fake SSL.

    You mentioned the setting I changed to resolve it in the OP. I just changed this to the domain of the site, and no more nasty errors in the log ;)

    umbracoSettings:settings/web.routing/@umbracoApplicationUrl - This is not set in our project

    I don't have access to the site from here, but can double check the value of that setting later if you need.

    Hope that helps.

    Dan

  • Kieron McIntyre 116 posts 359 karma points
    Nov 06, 2017 @ 18:26
    Kieron McIntyre
    0

    Hi Dan, yes that helped although like I mentioned in one of the previous comments, I'm reluctant to make changes to mask the issue.

    However, I think in the short term I will do as yourself and Dave have suggested and set the web routing URL.

    Thanks for your help.

  • Dennis Öhman 32 posts 177 karma points c-trib
    Nov 06, 2017 @ 19:58
    Dennis Öhman
    0

    I hade the same problem with one site, but I didn't have time to debug it so I used IServerRegistrar2 with the url in appsettings so it will work with our build/deploy environment.

    Do you use "Application Initialization" and Azure web apps?

  • Kieron McIntyre 116 posts 359 karma points
    Nov 06, 2017 @ 20:12
    Kieron McIntyre
    0

    Interesting, I've seen a number of other threads with a similar issue but no real resolution. It would be good to get some documentation or help from on high on this.

    We're using App Services by the way.

  • Dennis Öhman 32 posts 177 karma points c-trib
    Nov 06, 2017 @ 21:21
    Dennis Öhman
    0

    We didn't have this problem before we updated, 7.3.8 to 7.6.11. We also use app services with staging slots.

  • Kieron McIntyre 116 posts 359 karma points
    Nov 06, 2017 @ 20:18
    Kieron McIntyre
    0

    Update: I added the umbracoApplicationUrl setting, cleared the [umbracoServer] table and restarted the website. This had the effect of adding the correct URL to the [umbracoServer] table (yay!) but after a minute or two the https://localhost URL record also appeared again.

    Once this record appears, the error log starts filling up again every 5 minutes.

    I have subsequently noticed that the computerName values in each row are different so I can only assume that there is a second Azure instance of our site running possibly? We are using deployment slots but this has previously caused an additional row to be added with the correct URL of the deployment slot, not localhost.

    Still stumped.

  • Matthew Wise 271 posts 1373 karma points MVP 4x c-trib
    Nov 07, 2017 @ 07:25
    Matthew Wise
    0

    Hi Kieron,

    Are either of you pointing at the live dB on your local machines? I know it's an obvious one but best to check :)

    Matt

  • Dennis Öhman 32 posts 177 karma points c-trib
    Nov 07, 2017 @ 07:28
    Dennis Öhman
    0

    No, but that was the first thought. =)

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

    I know this is an old post for v7, but in case other people run into similar issues on Umbraco 8.6+ and stumble upon this.
    There's now a way to manually set the URL that is being pinged for keepAlive. (You can also disable the keepalive task in case you already have redundant functionality such as "Always On" on Azure App Service)

    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="false" keepAlivePingUrl="{umbracoApplicationUrl}/api/keepalive/ping" />
    </settings>
    

    I wrote a blog post on it here: https://swimburger.net/blog/umbraco/introducing-umbracos-keepalive-ping-configuration

  • Alan Mitchell 57 posts 279 karma points c-trib
    Sep 03, 2021 @ 09:18
    Alan Mitchell
    0

    Thanks for the details @Niels

    On an Umbraco cloud install (8.15.2) I am getting a full error log of these kinds of messages

    Keep alive failed (at '"https://localhost/umbraco/api/keepalive/ping"')

    Because Umbraco cloud runs on Azure App Services, does anyone know if it is okay to disable the keep alive task using this config setting?

  • tjimbaaa 2 posts 72 karma points hq
    Sep 03, 2021 @ 12:17
    tjimbaaa
    1

    We don't recommend disabling keepalive task off, but I can guide you through the process so it doesn't come up again.

    Here's some step for you to follow:

    The first step is to clone the project to your local environment

    The next thing is to look at the UmbracoSettings.config file and see if it has the following lines:

    <keepAlive disableKeepAliveTask="false" keepAlivePingUrl="{umbracoApplicationUrl}/api/keepalive/ping"/>
    

    After this, you need to create the config transform files for each env

    You can read more about config transform files here https://our.umbraco.com/documentation/Umbraco-Cloud/set-up/Config-Transforms/

    These files needs to be created on a local clone of your project, as this will ensure that the file is added to the project repository.

    The config transform file needs to have the following lines: (Remember to add your project env url)

    <?xml version="1.0" encoding="utf-8" ?> <settings xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> <keepAlive disableKeepAliveTask="false" keepAlivePingUrl="https://PROJECT ENV URL GOES HERE.euwest01.umbraco.io/api/keepalive/ping" xdt:Locator="Match(keepAlivePingUrl)" xdt:Transform="Replace"/> </settings>
    

    When you've done all of the things above you need to push it to the cloud, and across all environments

  • Shuchita 41 posts 150 karma points
    Aug 12, 2022 @ 13:20
    Shuchita
    0

    I have done the same but not working. I have added these three files: umbracoSettings.development.xdt.config umbracoSettings.staging.xdt.config umbracoSettings.live.xdt.config

      <?xml version="1.0" encoding="utf-8" ?><settings xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"><keepAlive disableKeepAliveTask="false" keepAlivePingUrl="https://my-dev-env-url.euwest01.umbraco.io/api/keepalive/ping" xdt:Locator="Match(keepAlivePingUrl)" xdt:Transform="Replace"/></settings>
    
      <?xml version="1.0" encoding="utf-8" ?><settings xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"><keepAlive disableKeepAliveTask="false" keepAlivePingUrl="https://my-staging-env-url.euwest01.umbraco.io/api/keepalive/ping" xdt:Locator="Match(keepAlivePingUrl)" xdt:Transform="Replace"/></settings>
    
      <?xml version="1.0" encoding="utf-8" ?><settings xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"><keepAlive disableKeepAliveTask="false" keepAlivePingUrl="https://my-live-env-url.euwest01.umbraco.io/api/keepalive/ping" xdt:Locator="Match(keepAlivePingUrl)" xdt:Transform="Replace"/></settings>
    

    I am using Umbraco 8.18.4, Any idea what can be the problem?

Please Sign in or register to post replies

Write your reply to:

Draft