views:

203

answers:

2

We have a Windows service written in C#. it is crashing after running for sometime about 5-6 hours. Our C# Windows service calls Un-Managed code which is a COM component.

The only error information I get from Event Viewer is:

Faulting application application.exe, version 2.2.2.0, stamp 45ed8d14, faulting module comcomponent.dll, version 5.2.3790.3959, stamp 45d70ad8, debug? 0, fault address 0x0000bee7.

Is there any way to keep windows service alive/running continuously by running un-managed code in different process?

As of now we've tried AppDomain as different process but it failed to overcome this issue.

Please suggest a suitable solution.

+1  A: 

Even if you spin up a new AppDomain, it's still the same process.

Since you are already using COM, I think .NET Enterprise Services would be an optimal solution for you. Among many other features, Enterprise Services can host your COM object in a different process.

Mark Seemann
Can you guide me how to do with Enterprise services as i'm new to use.....NET Enterprise Services
sukumar
It's really only another word for COM+, so you can use the standard COM+ tools to configure your COM component for out-of-process activation and hosting.
Mark Seemann
A: 

Hi sukumar.

In addition to trying to make your code as robust as possible, you may want to take a look at Service Protector. It will automatically restart your mission-critical service when it crashes, hangs or stops for whatever reason, and will send you email to let you know what happened. Take advantage of the free 30-day trial to ensure that it will help solve your problem.

Good luck!

CoreTech