什么目录Windows服务在运行? [英] What directory does a Windows Service run in?

查看:165
本文介绍了什么目录Windows服务在运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个非常简单的.NET Windows服务和使用InstallUtil.exe工具安装它。

I've created a very simple .NET Windows Service and installed it using InstallUtil.exe utility.

在服务,我有一块code这样:

In the service I have a piece of code as such:

if (File.Exists("test_file.txt"))
{
   // Do something clever
}

永远不会被执行

我已经创建了一个名为test_file.txt在相同的目录服务,但的code中的注释部分文件...?

I've created a file called test_file.txt in the same directory as the service but the commented part of the code is never being executed...?

推荐答案

服务是由被称为服务控制管理器应用程序启动。此应用程序住在系统目录下的%WINDIR%\ System32下

Services are started from an application called Service Control Manager. This application lives in the system directory %WinDir%\System32

在Windows 7旗舰版 - 64位这条路其实是:%WINDIR%\ Syswow64资料

On a Windows 7 Ultimate - 64 bits this path is actually : %WinDir%\SysWOW64

有关详细信息,请参见服务控制管理器在MSDN

For more information see Service Control Manager at MSDN.

感谢哈珀谢尔比您指出的问题,原单后。

Thanks Harper Shelby for pointing out problem with orginal post.

这篇关于什么目录Windows服务在运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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