Health Monitoring

Azure Traffic Manager Endpoint Degraded? by Derek Hunziker

If you're running Sitecore in Windows Azure, you may notice that your Traffic Manager endpoint has become "Degraded".

sitecore-azure-traffic-manager-heartbeat-degraded

I was pretty startled when I discovered this, as I thought it meant that my production instances were failing to respond. Thankfully, though, my CD instances were perfectly healthy, however the Sitecore URL that it was configured to monitor was not. The URL in question is that of the Sitecore Heartbeat service page, located at:

/sitecore/service/Heartbeat.aspx

At first glance, it looks like an ordinary Web Forms page, however, this page has some special functionality that you should be aware of. When this page is requested, it loops over all of your project's connection strings and tries to establish a valid SQL Connection to each and every one. If a valid connection cannot be made, the page will return a 500 response code. The trouble with this is that certain versions of Windows Server, as well as a number of tools such as the .NET MySQL Connector, will place empty and/or invalid connection strings into your system's machine.config file (often with the name of LocalSqlServer or LocalMySqlServer). When Sitecore encounters these invalid connection strings, it will try (and fail) to connect to them.

The solution is quite simple, and I'd recommend doing this even if you're not having problems in Windows Azure. Simply add a <clear/> to your ConnectionStrings.config before the Sitecore connection strings are defined:

<?xml version="1.0" encoding="utf-8"?>
<connectionStrings>

  <!-- Clear connection strings that may be added by machine.config by default.
       Invalid connection strings will cause Sitecore's HeartBeat.aspx service to return a 500 error. -->
  <clear/>

  <!-- 
    Sitecore connection strings.
    All database connections for Sitecore are configured here.
  -->
  <add name="core" connectionString="..." />
  <add name="master" connectionString="..." />
  <add name="web" connectionString="..." />

</connectionStrings>