Published Date: 13 December, 2020

What is the use of Sitecore Service - Heartbeat.aspx?

Sitecore internally does not use this service. It provides this service for the developers/technical people to check the Sitecore health.

Sometime website goes down. One of the major issue behind this is your website is not able to connect database. Sitecore provide a service to check the connectivity from all the available databases. It parse ConnectionString.config file and read all the available connectionString.

Heartbeat.aspx - 500 Internal Server Error

Hearbeat.aspx parse all the connectionString available in the ConnectionString.config file and try to establish the connection for all the mentioned connectionString one by one. If any one of the connectionString mentioned in this file fail to establish the connection, it throws error. You can find the below issue in the log file.

26964 15:55:10 FATAL SINGLE MSG: Sitecore heartbeat: Exception:
System.Exception
Message: Cannot access database defined by "< connectionString_name>" connection string.

connectionString_name: The first connectionString name which got failed while establishing the connection.

It throws 500 error on the UI.

http://www.tekkishare.com

Resolution

ConnectionString.config file contain lots of connectionString. This file not only contain the connectionString for the SQL Server databases, it also contain the URL of the OOTB external URLs like Search Url (solr.search, cloud.search), xConnect URL and few certificate detail (xconnect.collection.certificate, xdb.referencedata.client.certificate) as well.

Hearbeat.aspx service checks only SQL Server databases connection string. So should instruct Sitecore to exclude the database connectivity check for few of the mentioned databases connectionString. We can use following setting to exclude the connectivity check:

<setting name="Sitecore.Services.Heartbeat.ExcludeConnection" value="LocalSqlServer" />

You can put all your connectionString names having pipe separated here. Make sure you have included LocalSqlServer as well.

<setting name="Sitecore.Services.Heartbeat.ExcludeConnection" value="LocalSqlServer|sitecore.reporting.client|sitecore.reporting.client.certificate|solr.search| cloud.search" />

You should create a patch file having the above setting to override the existing setting. This will fix your 500 issue. Now open your Heartbeast.aspx file. This time it would not give your any error. It would be blank. It indicates that your database connectivity is working as expected.

https://sc100.sc/sitecore/service/Heartbeat.aspx

After this, when your CD website is down, you should check this Heartbeat.aspx service to check the SQL server infrastructure/connectivity is working fine or not.



References: