Office Online (WACSM) service cannot be started
Symptoms
The Office Online service (WACSM) fails to start from the Services console and PowerShell with this error:
The Office Online service on Local Computer started and then stopped. Some service stop sutomatially if they are not in use by other service or programs.
In the Windows Application event logs and as well as sometimes in the Trellix event logs, the following error appears:
ExP:DEP Stack Blocked an attempt to exploit C:\WINDOWS\SYSTEM32\INETSRV\W3WP.EXE
In addition, the Windows Application event logs show:
Service cannot be started. System.InvalidOperationException: The certificate has not been specified.
Even with the Office Online service not running in any of the farm members, OOS still renders Office documents, which is strange. As expected, however, it won’t let you run any Office Online PowerShell commands (e.g. Get-OfficeWebAppsFarm).
Causes
Case 1: A certificate with the same Subject name is found in the Personal Certificates store. Both Trellix and Application event logs were generated for this problem.
Case 2: C:\ProgramData\Microsoft\OfficeWebApps\Data\FarmState\setting.xml has a different value of the certificate’s Friendly Name for the CertificateName node:
Resolution
Case 1: Remove the duplicate certificate. When you add a new cert because the old one is expiring, do not leave the old and new ones together. Note that the Trellix event shows “Blocked by Threat Prevention: Exploit Prevention”, but this is misleading. Even with the Threat Prevention disabled, WACSM still fails to start.
Case 2: Manually edit the settings.xml file by matching the Friendly Name in the CertificateName’s StringValue. Note that this value gets generated in the XML file from the CertificateName param value of New-OfficeWebAppsFarm (i.e. when you set up the new farm) and it needs to exactly match the cert’s Friendly Name value.