Monday, September 21, 2015

Troubleshooting Citrix Desktop Service - "The Citrix Desktop Service is starting." and then nothing.

I'm troubleshooting an issue with the Citrix Desktop Service on my home lab.  I have a Citrix XenApp/XenDesktop 7.6 installation and I have setup a Server 2012 R2 box with the "/servervdi".  Upon reboot, I see the Registration State as Unregistered.


Restarting the Citrix Desktop Service and checking the 'Application' Log for 'Citrix Desktop Service' yields only event ID 1028 - "The Citrix Desktop Service is starting."

However, when I 'Stop' the Citrix Desktop Service the Application event log gives up a few more details:

Event ID 1003 - Citrix Desktop Service
The Citrix Desktop Service failed to initialize communication services required for interaction between this machine and delivery controllers. 

If the problem persists please perform a 'repair' install action or reinstall the Citrix Virtual Desktop Agent. Refer to Citrix Knowledge Base article CTX119736  for  further information. 

Error details: 
Failed to start WCF services. Exception 'Object reference not set to an instance of an object.' of type 'System.NullReferenceException'

Unfortunately, this CTX article gives little to no details on event 1003 and is more of a shotgun attempt at solving issues as opposed to a nice, precise, surgical solution.

From the EventID 1003 we can see the Citrix Desktop Service is trying to reference WCF services and it has failed.

Citrix offers a tool called XDPing to try and diagnose issues, I ran it and had it return the following:


Googling the WCF errors with HTTP/1.1 and Error 503 results in lots of information on reconfiguring your IIS.  I'm not convinced this is the issue so I soldiered on...

When I procmon on 'BrokerAgent.exe' I see a few curious entires that maybe associated with 'System.NullReferenceException' (aka, not found) and those are some permissions stating that access is denied to some registry keys and/or some 'Name Not Found' on some CLSID items.



During this capture I can see a 'BrokerAgent.config' file referenced.  ("C:\Program Files\Citrix\Virtual Desktop Agent\BrokerAgent.exe.config" ) Diving into it reveals some additional logging we can enable:

Verbose logging disabled by default


If we 'enable' the debug portions and create the C:\cdsLogs folder we can get some more information on what is going wrong.</p><p><br></p><table class=" style="margin-left: auto; margin-right: auto; text-align: center;" tr-caption-container="">

Logging Enabled



Stopping the 'Citrix Desktop Service', editing the .config file, creating the C:\cdslogs folder and starting the service yielded additional information.



We have a 'COM exception'.  The nice thing about this log file is we can compare the time stamps to the procmon logs and determine what was happening when this failed.


It appears we are missing SCService64.exe from our Citrix installation.  What is 'SCService64.exe'?  The registry tells me it's the 'IStackControl Type Library'.  Which matches up with the error 'ConnectToStackControlCOMServer'.

So, it appears we need to install SCService64.exe.  I do not know why or how it went missing but I suspect we can copy it over or extract from the Citrix source files if needed.

To extract the SCService64.exe source file, we can create an administrative installation of the "TS" VDA:

msiexec /a "\\x79-server\software\Citrix\XenApp_and_XenDesktop7_6\x64\Virtual Desktop Components\TS\IcaTS_x64.msi"
This makes a folder on the root of the C:\ called "Citrix" which installs all the files there:



I installed the Citrix VDA "WS" with /servervdi for some testing, but prior to that I had the regular "TS" VDA installed.  Perhaps some combination of my installation/uninstallation caused my issues.

Anyways, copying the SCService64.exe to the C:\Program Files (x86)\Citrix\System32 folder and restarting the 'Citrix Desktop Service' resulted in...


Registered, Hurray!

And what about our log file?

Previously it died around 'Setting up ALL LaunchManager WCF service'; this time we see:


Hurray!  It continues and operates without issue.

Be sure to re-disabled the logging on the BrokerAgent.config file and restart the service because I've found this BA_1.log can get to become a huge file.

Running XDPing this time results in [OK] across where the errors once were.

1 comment:

  1. Great post! Had the exact same situation with an 08R2 VM where the Server VDA was installed before the Desktop VDA.

    ReplyDelete