简体   繁体   中英

Is a c++ windows service more stable than a .Net windows service -?

I am just curious to know if at all there is any technical/theoretical reasons for a windows NT service to be more stable that created with c++ rather than .Net application or vice versa.

Actually I had two Nt Services one made with cpp and other with .Net application. I observe both as showing in start mode but I need to restart service created by .Net often(on average once every 2 days) to respond. When I tried to know about this strange behavior of .Net service some of my friends come up with answers related to OS internals and some say .Net was build like that. I am totally unaware of .Net platform so in finding the reason this forum is one of my attempt.

Thanks

Anil

You would probably gain some performance with C++ (if it is native) than with .NET, but this would be only during the startup. Once they are both up and running, there shouldn't be much of a difference.

However, creating a service through native C++ (as far as I can remembe now) was really pain and it took quite a bit of time. With .NET it is much easier and faster. To be honest, I never had a need to create some super important high speed service. I have created quite a number of services in .NET and they successfully do their job. In these cases the business end result was more important than the actual performance.

It is really all about your needs, but as someone said in the comment, the service will be as stable as the programmer wrote it. If you are more comfortable creating a service for controlling a nuclear reactor in .NET, do it in .NET. :-)

The C++ Service, or any win32 executable, will continue to work across multiple versions of windows, both future and past. This gives win32 longevity and near immunity to changes in the server. Your C++ service will likely not have very many, or none at all, dependencies on anything installed on the server. This reduces the number of points of failure.

.Net applications are highly fragile and can cost a lot of money to repair a failed .net application. The fragilness comes from an application being finicky on the version of .net framework installed on the server. Microsoft has a short lifespan on .net versions. .Net has lots of dependencies that increase points of failure such as a high number or assembly files and sensitive config files.

In conclusion, C++/Win32 will be much more stable due to the stability of win32 and having much fewer dependencies.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM