New-OfficeWebAppsFarm : The Office Online service failed to start. See the Windows Application Event Log for more details
Issue
While building your Office Online Serverfarm by running the command "New-OfficeWebAppsFarm", you may get an error as the below:
New-OfficeWebAppsFarm : The Office Online service failed to start. See the Windows Application Event Log for more details. At line:1 char:1 + New-OfficeWebAppsFarm -InternalURL "https://oos.ahmedamin.com" -Exter ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (:) [New-OfficeWebAppsFarm], ApplicationFailedException + FullyQualifiedErrorId : AgentManagerStartFailed,Microsoft.Office.Web.Apps.Administration.NewFarmCommand
Checking the event log will show the below:
Log Name: Application
Source: WACSM
Date: 21.09.2017 10:39:55
Event ID: 0
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: server
Description:
Service cannot be started. System.TypeInitializationException: The type initializer for 'Microsoft.Office.Web.Common.Log' threw an exception. ---> System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.String.ReplaceInternal(String oldValue, String newValue)
at System.String.Replace(String oldValue, String newValue)
at Microsoft.Office.Web.Common.Log.GetQuotedEscapedStringOrNull(Object input)
at Microsoft.Office.Web.Common.Log.GetMessageForExceptionLogging(String verb, Exception originalException, Tuple`2[] info)
at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32 tag, String verb, Exception originalException, Tuple`2[] extraInfo)
at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32 tag, EventId id, Object[] insertionData)
at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32 tag, String verb, Exception originalException, Tuple`2[] extraInfo)
at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32 tag, EventId id, O...
Log Name: Application
Source: .NET Runtime
Date: 21.09.2017 10:39:57
Event ID: 1026
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: server
Description:
Application: Microsoft.Office.Web.AgentManager.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.OutOfMemoryException at System.String.ReplaceInternal(System.String, System.String) at System.String.Replace(System.String, System.String) at Microsoft.Office.Web.Common.Log.GetQuotedEscapedStringOrNull(System.Object) at Microsoft.Office.Web.Common.Log.GetMessageForExceptionLogging(System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceWithoutRetraceOnException(UInt32, System.String, System.Exception, System.Tuple`2<System.String,System.Object>[]) at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Common.Log.TraceTag(UInt32, Microsoft.Office.Web.Common.LogCategory, Level, System.String, System.Object[]) at Microsoft.Office.Web.Common.Log..cctor() Exception Info: System.TypeInitializationException at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32, Microsoft.Office.Web.Common.EventId, System.Object[]) at Microsoft.Office.Web.Environment.WacServer.AgentManager.AgentManagerApplication.CurrentDomain_UnhandledException(System.Object, System.UnhandledExceptionEventArgs)
Log Name: Application
Source: Application Error
Date: 21.09.2017 10:39:59
Event ID: 1000
Task Category: (100)
Level: Error
Keywords: Classic
User: N/A
Computer: server
Description:
Faulting application name: Microsoft.Office.Web.AgentManager.exe, version: 16.0.7329.1023, time stamp: 0x58145a49
Faulting module name: KERNELBASE.dll, version: 10.0.14393.1715, time stamp: 0x59b0d106
Exception code: 0xe0434352
Fault offset: 0x0000000000033c58
Faulting process id: 0x2f0
Faulting application start time: 0x01d332b51759f9e6
Faulting application path: C:\Program Files\Microsoft Office Web Apps\AgentManager\Microsoft.Office.Web.AgentManager.exe
Faulting module path: C:\Windows\System32\KERNELBASE.dll
Report Id: a6a0f8c7-52d1-4be5-aae9-ae4d627a0d4d
Faulting package full name:
Faulting package-relative application ID:
Cause
Unfortunately, the error message "System.OutOfMemoryException" from the event log is misleading, as the root cause has nothing to do with memory :). Anyway, digging deeper in this issue by capturing a memory dump from the application "Microsoft.Office.Web.AgentManager.exe" showed the below:
!DumpObj /d 00000000112c0870
Name: System.String
MethodTable: 00007ff8c7cc6948
EEClass: 00007ff8c75c50e0
Size: 1092544(0x10abc0) bytes
File: C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll
String: An exception was thrown while writing event. { originalException = "System.ArgumentException: Only the first eight characters of a custom log name are significant, and there is already another log on the system using the first eight characters of the name given. Name given: 'Microsoft Office Web Apps', name of existing log: 'Microsoft-Windows-DSC/Operational' .
at System.Diagnostics.EventLog.CreateEventSource(EventSourceCreationData sourceData)
at System.Diagnostics.EventLogInternal.VerifyAndCreateSource(String sourceName, String currentMachineName)
at System.Diagnostics.EventLogInternal.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category)
at Microsoft.Office.ServiceInfrastructure.Runtime.EnvironmentAdapters.ANtEventLogAdapter.WriteEventEntry(EventLog log, Int32 id, EventLogEntryType type, String eventMessage, Int16 category)
at Microsoft.Office.ServiceInfrastructure.Runtime.EnvironmentAdapters.ANtEventLogAdapter.WriteEventTag(UInt32 tag, EventId id, Object[] insertionData)
at Microsoft.Office.Web.Common.Log.WriteEventTag(UInt32 tag, EventId id, Object[] insertionData)", insertionData : ["An exception was thrown while writing event. { originalException = \"System.ArgumentException: Only the first eight characters of a custom log name are significant, and there is already another log on the system using the first eight characters of the name given. Name given: 'Microsoft Office Web Apps', name of existing log: 'Microsoft-Windows-DSC/Operational'.
at System.Diagnostics.EventLog.CreateEventSource(EventSourceCreationData sourceData)
at System.Diagnostics.EventLogInternal.VerifyAndCreateSource(String sourceName, String currentMachineName)
at System.Diagnostics.EventLogInternal.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category)
at Microsoft.Office.ServiceInfrastructure.Runtime.EnvironmentAdapters.ANtEventLogAdapter.WriteEventEntry(EventLog log, Int32 id, EventLogEntryType type, String eventMessage, Int16 category)
After checking the registry key location "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog", we noticed that it has the sub-key "Microsoft-Windows-DSC/Operational" which is preventing the creation of the registry key "Microsoft Office Web Apps". Honestly, we have no idea what created this key, as checking several machines in house did not show that key in this location.
Solution
Uninstall the software which created the conflicting registry key at "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog", or delete the key by yourself, and then re-run the command which should run successfully without any problem. Take into consideration that deleting this key will impact your software which created this registry key in the first place.