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?
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.
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.
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?
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.
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.
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 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
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:
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 toApplicationUrlHelper.EnsureApplicationUrl()
.So, the domain used in
KeepAlive
is determined from the following steps, in order: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?
Hi Kieron,
I see it's trying to access https://localhost
Do you have configured umbraco to run under SSL ?
Dave
Hi Dave, yes I have. Both locally and in production.
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
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.
Do you also access the site using localhost as domain ?
Dave
That's the thing, we don't. If we did, that would certainly explain it.
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 ;)
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
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.
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?
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.
We didn't have this problem before we updated, 7.3.8 to 7.6.11. We also use app services with staging slots.
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.
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
No, but that was the first thought. =)
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
:I wrote a blog post on it here: https://swimburger.net/blog/umbraco/introducing-umbracos-keepalive-ping-configuration
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
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?
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:
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)
When you've done all of the things above you need to push it to the cloud, and across all environments
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
I am using Umbraco 8.18.4, Any idea what can be the problem?
is working on a reply...