We are getting error on server and our service is automatically stopped in the server. Randomly application is crash in approx 1 hour with below Error as -
Faulting application name: Chubb.Studio.Event.Processor.exe, version: 0.0.0.0, time stamp: 0x5c0ab1b7 Faulting module name: KERNELBASE.dll, version: 6.3.9600.19425, time stamp: 0x5d26b6e9 Exception code: 0xc0000005 Fault offset: 0x0000000000001556 Faulting process id: 0x115c Faulting application start time: 0x01d5a35fd202f96d Faulting application path: E:\WindowsService\DevInt\Chubb.Studio.EventProcessor\Chubb.Studio.Event.Processor.exe Faulting module path: C:\Windows\system32\KERNELBASE.dll Report Id: 762c15d4-0f5b-11ea-8120-005056a27597 Faulting package full name: Faulting package-relative application ID:
Our Code is look like as -
   protected override void OnStarted()
    {
        //IntializeEventsExecution();
        Task task = Task.Factory.StartNew(() => IntializeEventsExecution());
        base.OnStarted();
    }
    public void IntializeEventsExecution()
    {
        StartEvents();
    }
    public void StartEvents()
    {
        var eventList = GetEventTopics();
        Parallel.ForEach(eventList,
           new ParallelOptions { MaxDegreeOfParallelism = eventList.Count },
           (item, state, index) =>
           {
               StartProcessingEvent(eventList[(int)index]);
           });
    }
    /// <summary>
    /// 
    /// </summary>
    /// <param name="index"></param>
    public void StartProcessingEvent(EventTopic topic)
    {
        try
        {
            Task task = Task.Factory.StartNew(() => ExecuteProcessingEvent(topic));
            task.Wait();                
        }
        catch (Exception)
        {
        }
        finally
        {
            new _processingDelegate(StartProcessingEvent).Invoke(topic);
        }
    }