C#:运行和调试Windows服务 [英] C#: Running and Debugging a Windows Service

查看:49
本文介绍了C#:运行和调试Windows服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用C#构建Windows服务,但我不知道如何调试它.

I am currently building a Windows Service with C# and I just can't figure out how to debug it.

我正在构建它,然后向 installutil 注册:

I am building it and then registering with installutil:

> installutil MusicRepo_FileMonitor.exe

The Commit phase completed successfully.

The transacted install has completed.

正如您在上面看到的,它应该已经成功注册,但是我在 services.smc 中找不到它.我也尝试过使用 net start [ServiceName] 启动服务,但它告诉我服务名称无效.,所以我想找不到它.

And as you can see above, it is supposedly being registered successfully, but I can't find it in services.smc. I have also tried starting the service with net start [ServiceName] but it's telling me The service name is invalid. so I guess it's not finding it.

出于记录,我使用的是Vista,并且正在使用.Net 3.5开发ws

For the record, I'm on Vista and I'm developing the ws with .Net 3.5

[更新]

解决方案

推荐答案

在进一步研究中,我意识到我没有将该服务附加到安装程序,因此现在通过添加安装程序来解决此问题.

Upon further research, I realized that I had no Installer attached to the service, so the problem was now fixed by adding an Installer.

这里是我用来添加服务安装程序的教程,等等.

Here is the tutorial I used to add a Service Installer and so on.

这篇关于C#:运行和调试Windows服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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