When we see an error with event ID 505 “The Citrix Config Sync Service failed an import” in Application event log reported every 1 minute it means that Local Host Cache requires our attention. In my previous post I documented some troubleshooting procedures to verify the root cause issuse but in some cases LHC recreation is required. For more information about Local Host Cache troubleshooting see my post XenDesktop 7.15 Local Host Cache troubleshooting.

Solutions listed below are valid for XenApp or XenDesktop version 7.12 or later.

Solution 1

Disable and Enable the LocalHostCache Feature:

Step 1 – Check the Status of Local Host Cache:

  • Open PowerShell on the Delivery Controller and run the command “asnp Citrix*”
  • Display site configuration using command Get-BrokerSite. LocalHostCacheEnabled Option must be set to True and the ConnectionLeasingEnabled property is False. Output is presented in the Figure 1 below

Figure 1

Step 2 – Disable the LocalHostCache Feature

  • In the PowerShall console run the Set-BrokerSite command: 
#
Set-BrokerSite -LocalHostCacheEnabled $false -ConnectionLeasingEnabled $true
#

Step 3 – Delete local host cache files located in C:\Windows\ServiceProfiles\NetworkService folder

  • Open PowerShell on the Delivery Controller and rune the following commands

delete C:\Windows\ServiceProfiles\NetworkService\*.mdf

delete C:\Windows\ServiceProfiles\NetworkService\*.ldf

Step 4 – Enable the LocalHostCache Feature:

  • In the PowerShall console run the Set-BrokerSite command:
#
Set-BrokerSite -LocalHostCacheEnabled $true -ConnectionLeasingEnabled $false
#

 

Solution 2

Recreate LHC on the Delivery Controller manualy using the following steps:

Step 1 – Stop Citrix High Availability Service. The command example is listed below.

#
Get-Service CitrixHi* |Stop-Service
#

Step 2 – Delete LocalDB CitrixHA instance

  • Download PsExec on the Delivery Controller from PsExec – Windows Sysinternals 
  • Open the CommandPrompt and PsExec in the Network Service account context. The command example is listed below.
#
psexec -i -u "NT AUTHORITY\NETWORK SERVICE" cmd 
#
  • Run the command “whoami ” to confirm service account.

Important note:

Please make sure you run PsExec in the Network Service account context. Tool SqlLocalDB.exe lists all instances of SQL LocalDB owned by the current user.

  • In the command prompt navigate to the path  “C:\Program Files\Microsoft SQL Server\120\Tools\Binn”
  • Display the SQL local DB instances configured on the Delivery Controller. Use command “SqlLoaclDB i|info”. As you see on this server we have 2 localDB instances: default instance MSSQLLocalDB and our CitrixHA instance. (Do not close command prompt window)
#
SqlLocalDB i
#

Output is presented in the Figure 2 below.

Figure 2

  • Stop and delete CitrixHA (LocalDB) Database. The command example is listed below. (Do not close command prompt window)
#
SqlLocalDB Stop CitrixHA
#
SqlLocalDB Delete CitrixHA
#
SqlLocalDB i
#

Output is presented in the Figure 3 below.

Figure 3

  • Delete local host cache files located in C:\Windows\ServiceProfiles\NetworkService folder

delete C:\Windows\ServiceProfiles\NetworkService\*.mdf

delete C:\Windows\ServiceProfiles\NetworkService\*.ldf

Step 3 – Start Citrix High Availability Service

#
Get-Service CitrixHi* |Start-Service
#

Step 4 – Confirm that CitrixHA is recreated

  • Display the SQL local DB instances configured on the Delivery Controller. Use command “SqlLoaclDB i|info”. CitrixHA instance should be displayed when Citrix High Availability Service is started. Please make sure you use the same command prompt session.

 

Problem should be solved now. Event ID 505 – Citrix Config Sync Service failed an import should not be reported any longer.

I hope you will find this post useful. Feel free to add your comments and rate this article.

[yasr_visitor_votes size=”medium”]