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 108 posts 325 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 3242 posts 10999 karma points MVP 5x 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 108 posts 325 karma points
    Nov 06, 2017 @ 14:28
    Kieron McIntyre
    0

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

  • Dave Woestenborghs 3242 posts 10999 karma points MVP 5x 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 108 posts 325 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 3242 posts 10999 karma points MVP 5x admin c-trib
    Nov 06, 2017 @ 14:59
    Dave Woestenborghs
    0

    Do you also access the site using localhost as domain ?

    Dave

  • Kieron McIntyre 108 posts 325 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 108 posts 325 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 29 posts 130 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 108 posts 325 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 29 posts 130 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 108 posts 325 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 237 posts 999 karma points MVP 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 29 posts 130 karma points c-trib
    Nov 07, 2017 @ 07:28
    Dennis Öhman
    0

    No, but that was the first thought. =)

  • Niels Swimberghe 16 posts 97 karma points c-trib
    1 week ago
    Niels Swimberghe
    0

    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

  • toyoika 2 posts 72 karma points
    1 week ago
    toyoika
    0

    Hi! I read the story with pleasure. I like things like that. I am from https://worldpostalcode.com/united-states/new-york/new-york-city, and I drove a bike a lot in olden days. But after a trauma, I cannot do it anymore. I broke a leg very badly, and now I am not in shape for bike driving. But I have found a lot of different forums and blogs about bikes, which I like a lot.

Please Sign in or register to post replies

Write your reply to:

Draft