如何使用c#在Windows服务中存储永久值 [英] how to store permanent values in windows service using c#

查看:92
本文介绍了如何使用c#在Windows服务中存储永久值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个窗口服务。现在我想永久存储一个值。那我怎么能这样做呢?

I have created a window service. Now I want to store a value permanently in it. So how can i do this?

推荐答案

服务就是一种服务。它是一个在后台运行的应用程序。

如果你想在其中存储一些东西,你需要修改代码。

但是没有在它里面 ,由于服务是一个应用程序,它可以由多种文件组成。因此,您可以将配置或数据文件放在您修改的可执行文件旁边。

或者您可以使用注册表来存储值。如果您谈论运行时参数,那么注册表(HKLM)就是它的位置。
A service is a service. It is an application that runs in background.
If you want to store something "in it" you need to modify the code.
But there is no "in it", as the service is an application, it is can be made of many kind of files. So you can have a configuration or data file aside the executable that you modify.
Or you can use the registry to store the value. If you speak about a runtime parameter, than the registry (HKLM) is the place for it.


这篇关于如何使用c#在Windows服务中存储永久值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆