无需安装运行Windows服务中的应用 [英] Running Windows Service Application without installing it
问题描述
Whem我正在写一个Windows服务,只需按F5我得到了我使用 installutil.exe
来安装它,然后运行它的错误消息。
实际上,这意味着每次我换行code:
Whem I'm writing a Windows Service and just hit F5 I get the error message that I have to install it using installutil.exe
and then run it.
In practice this means everytime I change a line of code:
- 编译
- 切换到开发者的命令提示符
- 删除旧版本
- 在安装新版本
- 在启动服务
这是非常不方便的。有没有更好的办法做到这一点?
That is very inconvenient. Is there a better way to do it?
推荐答案
我通常把大部分的服务实现为一个类库,然后创建两个前端的运行它 - 一个服务项目中,其他控制台或Windows窗体应用程序。我用的是控制台/表格应用程序进行调试。
I usually put the bulk of the service implementation into a class library, and then create two "front-ends" for running it - one a service project, the other a console or windows forms application. I use the console/forms application for debugging.
不过,你应该知道,在调试的经验与环境的差异,作为一个真正的服务运行时 - 如:你可能会意外地结束了依赖于会话与交互式用户,或(对于的WinForms),其中一个消息泵运行时运行。
However, you should be aware of the differences in the environment between the debug experience and when running as a genuine service - e.g. you can accidentally end up dependent on running in a session with an interactive user, or (for winforms) where a message pump is running.
这篇关于无需安装运行Windows服务中的应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!