SharePoint 2013. Excel Services. w3wp.exe fails with "Exception code: 0x80131623"

I came across an issue the other day where the Excel Services failed to start in SharePoint 2013.
When a user clicked an *.xlsx file the following message was displayed in the browser

"We're sorry. We ran into a problem completing your request. Please try that again in a few minutes"

and the corresponding w3wp.exe process went down. I managed to reproduce this here and found the solution.
Basically this was down to a permission issue in the registry. Steps to see the issue and the solution below.

:: Removed "READ" permissions on HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\15.0 (in this case for the WSS_WPG group).
:: Did an IISReset to make sure all was properly reset and then tried to open a *.xlsx file. This produced the following:

# In the browser:

"We're sorry. We ran into a problem completing your request. Please try that again in a few minutes"

# In the ULS logs:

<date><time> w3wp.exe (0x2D30) 0x1958 Excel Services Application Web Front End acbd Critical   
Unable to reach Excel Calculation Services https://<servername>/e1413656e1ac4e948a91e26d5913011c/ExcelService*.asmx. [Session: User: <account>]       

<date><time> w3wp.exe (0x2D30) 0x1958 Excel Services Application Web Front End accf Medium     
ServerSession.ProcessWebException: A Web exception during ExecuteWebMethod has occurred for server: https://<servername>/e1413656e1ac4e948a91e26d5913011c/ExcelService*.asmx, method:
GetHealthScore, ex: System.Net.WebException: The remote server returned an error: (503) Server Unavailable.    
 at System.Net.HttpWebRequest.GetResponse()    
 at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout), response: 'System.Net.HttpWebResponse', status ProtocolError, user name: <account>.           

<date><time> w3wp.exe (0x2D30) 0x1958 Excel Services Application Web Front End acco Critical   
There was an error in communicating with Excel Calculation Services https://<servername>/e1413656e1ac4e948a91e26d5913011c/ExcelService*.asmx exception: The remote server returned an error: (503) Server Unavailable. [Session: User: <account>].

# In Process Monitor (https://technet.microsoft.com/sv-se/sysinternals/bb896645):

# In Event Viewer:

Faulting application name: w3wp.exe, version: 8.5.9600.16384, time stamp: 0x5215df96
Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0x80131623
Fault offset: 0x00007ffada0caf23
Faulting process id: 0x11e8
Faulting application start time: 0x01d03a1b81cbbc8c
Faulting application path: c:\windows\system32\inetsrv\w3wp.exe
Faulting module path: unknown
Report Id: d0141935-a60e-11e4-80d1-00155d3a280a
Faulting package full name:
Faulting package-relative application ID:
...

An internal error occurred.
   at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
   at Microsoft.Win32.Registry.GetValue(String keyName, String valueName, Object defaultValue)
   at Microsoft.Office.Excel.Server.MossHost.MossHost.get_HostBinaryPath()
   at Microsoft.Office.Excel.Server.CalculationServer.ExcelServerApp.Initialize()
   at Microsoft.Office.Server.Diagnostics.FirstChanceHandler.ExceptionFilter(Boolean fRethrowException, TryBlock tryBlock, FilterBlock filter, CatchBlock catchBlock, FinallyBlock finallyBlock)
...

Application: w3wp.exe
Framework Version: v4.0.30319
Description: The application requested process termination through System.Environment.FailFast(string message).
Message:
Stack:
   at System.Environment.FailFast(System.String)
   at Microsoft.Office.Excel.Server.HelperMethods.HandleShutdown(System.Exception, Boolean)
   at Microsoft.Office.Server.Diagnostics.FirstChanceHandler.ExceptionFilter(Boolean, TryBlock, FilterBlock, CatchBlock, FinallyBlock)
   at Microsoft.Office.Web.Common.ExceptionReporting.ReportOnExceptionTag(UInt32, Category, System.String, Boolean, Microsoft.Office.Web.Common.TryBlock, Microsoft.Office.Web.Common.CatchBlock, Microsoft.Office.Web.Common.FinallyBlock)
   at Microsoft.Office.Excel.Server.CalculationServer.ExcelServerApp..ctor()
   at Microsoft.Office.Excel.Server.CalculationServer.ExcelServerApp..cctor()
   at Microsoft.Office.Excel.Server.CalculationServer.ExcelServiceBase.SafeSetContext()
   at Microsoft.Office.Excel.Server.CalculationServer.ExcelServiceBase.BeginProcessOperation(Microsoft.Office.Excel.Server.CalculationServer.CommandParameter, Microsoft.Office.Excel.Server.WebMethodBehaviorAttribute, Microsoft.Office.Excel.Server.WebMethodType, System.AsyncCallback, System.Object, Microsoft.Office.Excel.Server.CalculationServer.Operations.UserOperation)
   at Microsoft.Office.Excel.Server.CalculationServer.ExcelServiceBase.BeginProcessOperation(Microsoft.Office.Excel.Server.CalculationServer.CommandParameter, Microsoft.Office.Excel.Server.WebMethodType, System.AsyncCallback, System.Object, Microsoft.Office.Excel.Server.CalculationServer.Operations.UserOperation)
   at Microsoft.Office.Excel.Server.CalculationServer.ExcelServiceSoap.BeginGetHealthScore(System.AsyncCallback, System.Object)
...

 

:: Adding back the READ permission on HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\15.0 (in this case for the WSS_WPG group) allows the *.xlsx to open again.

So if you come across the issue/errors shown above then make sure that the process account have the correct permissions in the registry.