douxin1163 2015-10-26 15:49
浏览 40
已采纳

建议在Windows服务中存储配置数据的方法是什么?

So, I have written a Windows service in Go using this API.

Everything is working well, but I am wondering what's the best way to store configuration data in a service.

Usually, I use SHGetKnownFolderPath to get to the AppData directory and create my app directory in there.

However, in a service this gives me a path in C:/Windows/system32/config/userprofile, which is fine technically since I can do what I need in there, but I'm left wondering if maybe there's a preferred way to store configuration.

Is it better to use the registry for this ? Or is there something else on Windows for this purpose ?

What do Windows sysadmins expect from a service in this case ?

Thanks.

  • 写回答

1条回答 默认 最新

  • dongya1875 2015-10-26 15:57
    关注

    You are almost always better off storing your configuration data in Registry. That is what a typical Windows admin would expect of a well behaved service. Windows ain't Unix. :-)

    You can use this package to interact with the registry.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 Yolov5训练报错
  • ¥15 Unity发布gzip压缩的webgl之后让浏览器可以正常显示画面
  • ¥15 有没有人知道这种提示怎么关?现在不做ts项目了不知道咋关了,求解,现在我以前的js项目都是这种提示了
  • ¥15 为什么mysql做了碎片化处理data_free还是很高
  • ¥15 single positional indexer is out-of-bounds
  • ¥15 LSTM 模型数据量需要多少?
  • ¥15 mysql数据抓包开发报表
  • ¥15 linux系统下安装office打不开
  • ¥20 rsync脚本分发错误,文件不齐全
  • ¥15 labview顺序结构与时间延时