We have a Windows service written in C#. it is crashing after running for sometime about 5-6 hours. Our C# Window开发者_如何转开发s 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.
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.
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!
精彩评论