tags:

views:

139

answers:

3

I'm going to design an Application (C# or VB.NET) which use .NET Framework to run for very long time. It may be restarted every year or even more...

Is there anything (using special design patterns or so) which I must care about in designing "Long time running applications in .NET"?

Is .NET ever a good platform for these kind of applications or I should use other platforms such as J2SE?

(It's not a web application.)

+5  A: 

I actually would say that using .NET is well-suited to long running applications. Managed code, in general, tends to do fairly well in this type of scenario, as a compacting GC helps prevent issues that can arise due to memory fragmentation over time.

That being said, it's difficult to give much guidance, as there's very little information in the question itself. The "every year or more" run times is not enough information to say that a particular framework or language choice would benefit - any language can work, as the issues that arise from long running applications tend to be more design issues, and less framework/language/toolset/etc.

I've written some .NET-based applications which run as services and stay continually running for very long times, and never had any issues with the application (at least none related to the technology itself).

Reed Copsey
+2  A: 

.NET's garbage collector is very good, so as long as you don't have any non-obvious memory leaks, that should be OK. "Non-obvious" includes not releasing event-handlers when you're truly done with them., using lambda expressions for event handlers in other classes, and that sort of thing.

Be sure that you're catching and logging all unhandled exceptions. If it does die, you'll want to know why.

Also, take a look at the application restart support in Windows 7. This can restart your app in case it does fail. Although it's written for unmanaged code, it's accessible for .net in the Windows 7 API code pack.

Cylon Cat
+4  A: 

I'd worry less about keeping an app running and more about what happens when it inevitably stops - and make no mistake, it WILL stop.

There are many factors that can go wrong; a crash, server fault, network failure or someone simply stopping the app. The true work will be resuming the application's tasks after it restarts.

Damien Dennehy
Good points. And if high-availability is an issue it's probably a good idea to duplicate critical resources (as this application/service=-
0xA3