Friday, 6 March 2015

The E-mail Router service could not run the service main background thread. The E-mail Router service cannot continue and will now shut down.

Because of some issues 'Microsoft CRM Email Router' service stopped automatically. On manual start it stopped immediately saying SystemState.xml is corrupt.

I found the actual error message (following) in event log. But most useful message was prior to this error message saying "Error accesing SystemState.xml. Restore file with last backup."

#16192 - The E-mail Router service could not run the service main background thread. The E-mail Router service cannot continue and will now shut down. System.Configuration.ConfigurationErrorsException: The E-mail router service cannot access system state file Microsoft.Crm.Tools.EmailAgent.SystemState.xml. The file may be missing or may not be accessible. The E-mail Router service cannot continue and will now shut down. ---> System.Xml.XmlException: Root element is missing.
   at System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res)
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
   at System.Xml.XmlDocument.Load(XmlReader reader)
   at System.Xml.XmlDocument.Load(String filename)
   at Microsoft.Crm.Tools.Email.Providers.ConfigFileReader..ctor(String filePath, ServiceLogger serviceLogger)
   at Microsoft.Crm.Tools.Email.Providers.SystemState.Initialize(ServiceLogger serviceLogger)
   at Microsoft.Crm.Tools.Email.Agent.ServiceCore.InitializeSystemConfiguration()
   --- End of inner exception stack trace ---
   at Microsoft.Crm.Tools.Email.Agent.ServiceCore.InitializeSystemConfiguration()
   at Microsoft.Crm.Tools.Email.Agent.ServiceCore.ExecuteService()

It gave me an idea that I need to find and restore the file from backup (if there is any). File was located at C:\Program Files\Microsoft CRM Email\Service\Microsoft.Crm.Tools.EmailAgent.SystemState.xml.

But Unfortunately there was not any backup. So I just renamed the file and restarted the service. It worked and started picking up pending emails gradually. 

For future use I have taken backup of SystemState.xml and Configuration.bin as suggested by Microsoft

P.S. Hayer

No comments :

Post a Comment