Windows服务问题 [英] Problem with Windows Service

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

问题描述

伙计们。我是Windows服务的新手,他们让我头疼。我使用的是VB.Net 2010 Professional。我完成了编码,使用[ServiceProcessInstaller1]和[ServiceInstaller1]创建了[ProjectInstaller]。当转到[设置和部署],选择[设置项目]时,问题开始。在我单击确定之前,有一个[解决方案]选项。其默认值为[创建新解决方案]。当我使用此选项单击确定时,我看不到[primaryoutput]。所以我选择[添加到解决方案]。然后我按照这些步骤



右键单击[Setup1],选择[查看]然后[自定义]

右键单击[自定义操作],然后[添加自定义操作]。所有文件夹都是空的,没有什么可供选择。



我回到[Setup1],右键单击,选择[添加],[项目输出]然后选择[主输出]

,配置为[Active],默认为单击确定。

[WindowsService1的主要输出]出现



我再次添加自定义操作,选择[主输出]



右键单击[Setup1]并选择[Rebuild]



我转到我保存项目的桌面,我看到一个名为[setup1]的文件夹,其中包含2个空文件夹[debug]和[release]以及[setup1]文件。希望它会安装,我双击它,它再次打开visual studio。



选项[install]和[unninstall]被禁用。当我设法启用它们时,不知道程序似乎如何安装

但是当我检查服务时,我的服务不可用



我再次重建但是这个错误

[无法构建名为'来自WindowsService1(Active)的主输出的自定义操作',因为它引用了已从项目中删除的对象。 C:\ Users\admin \Desktop\WindowsService1 \ Setup1 \Setup1.vdproj Setup1]



我错过了什么,我跟随了以下示例net,microsoft的演练示例。



请帮助

Hi again guys. I am really new to windows services and they are giving me a headache. I use VB.Net 2010 Professional. I am done with coding, created the [ProjectInstaller] with [ServiceProcessInstaller1] and [ServiceInstaller1]. The problem starts when goto [Setup and Deployement], choose [Setup Project]. Before i click OK there is a [Solution] option. The default value for that is [Create new solution]. When i click ok with this option i do not see [primaryoutput]. So I choose [Add to Solution] instead]. Then I follow these steps

Right click on [Setup1], choose [view] then [custom]
Right click on [Custom Actions], then [Add Custom action]. All of the folders are empty, there is nothing to select.

I go back to [Setup1], right click, select [Add], [Project Output] then choose [Primary Output]
with configuration [Active] selected as default i click ok.
[Primary Output from WindowsService1] appears

I add custom action again, select [Primary Output]

Right click on [Setup1] and select [Rebuild]

I go to desktop where i saved the project, i see a folder named [setup1] with 2 empty folders [debug] and [release] plus [setup1] file. Hoping it would install, I double-click on it and it opens visual studio again.

options [install] and [unninstall] are disabled. When i managed to enable them, dont know how
the program seemed to install but when i check under services, my service is not available

I rebuilt again but this error
[Unable to build custom action named 'Primary output from WindowsService1 (Active)' because it references an object that has been removed from the project. C:\Users\admin\Desktop\WindowsService1\Setup1\Setup1.vdproj Setup1]

What i am i missing, i followed examples from the net, microsoft's walkthrough example.

Please help

推荐答案

谢谢你们,我管理过。我意识到在VB.net 2010中做到最好的方法(在专业版上测试;



1.完成代码后,转到File> New项目

2. [设置和部署]> [Visual Studio安装程序]

3.而不是[安装项目]选择[安装向导]

4.在[解决方案]下选择[添加到解决方案]。这是最重要的部分。点击[确定]

5.出现设置窗口,单击[下一步]

6.选择[为Windows应用程序创建设置],再次单击[下一步]

7. [设置向导3/5]出现,选择[主要输出...]是重要的部分

8.接下来,完成

9.现在你回来了VB IDE

10.右击你的设置项目例如[Setup1]

11.选择[查看]> [自定义操作]

12.右键单击[自定义操作],单击[添加自定义操作]

13. [Ok],[Ok]

14.在[解决方案资源管理器]中右键单击每个项目ct,你看到并单击[Build]或[Rebuild]。约3项

15.右键单击您的设置项目,例如[Setup1]。应该启用[安装]和[卸载]

16.您可以从此处安装或转到步骤4中保存安装项目的位置,(查看项目文件夹)

17.在那里寻找例如[Setup1]文件夹,然后查找[Debug]文件夹。应该有2个exe文件。

18.单击其中任何一个安装

19.在您的计算机中(在Windows 7上测试)转到[服务]并找到您的服务或只需转到[任务管理器],[服务]选项卡,单击服务。这应该带您到服务台

20.右键单击您的服务并启动它

21.您的服务现在应该列在[任务管理器]中的服务

22.您的服务项目已完成并完成

23.编辑/调试停止服务

24.随着CMD升高(运行CMD)作为管理员)类型命令(没有方括号)[sc delete yourservicename]

25.再次安装服务转到16或17
Thank you guys I managed. I realized that the Best way to do it in VB.net 2010 (tested on Professional version;

1. After finishing with the code, go to File > New Project
2. [Setup and Deployment] > [Visual Studio Installer]
3. Instead of [Setup Project] choose [Setup Wizard]
4. Under [Solution] select [Add to Solution]. this is the most important part. Click [Ok]
5. Setup window appears, click [Next]
6. With [ Create a setup for a Windows application] selected, click [Next] again
7. [Setup wizard 3 of 5] appears, Select [Primary output from...] This is the important part
8. Next, Next, Finish
9. By now you are back VB IDE
10. Right click on your setup project e.g [Setup1]
11. Select [View] > [Custom Actions]
12. Right click on [Custom Actions], click [Add Custom Actions]
13. [Ok], [Ok]
14. In [Solution Explorer] right click on every project you see and click [Build] or [Rebuild]. About 3 items
15. Right click on your setup project e.g [Setup1]. [Install] and [Uninstall] should be enabled
16. You can install from here or go to where you saved the setup project in step 4, (look in your project folder)
17. in there look for e.g [Setup1] folder, then the [Debug] folder. There should be 2 exe files.
18. Click any of them to install
19. In your computer (tested on windows 7) Go to [services] and locate your service or simply go to [task manager], [services] tab, click services. that should take you to the services console
20. Right click on your service and start it
21. Your service should now be listed under services in [task manager]
22. Your service project is finished and complete
23. To edit/debug stop the service
24. With an elevated CMD (run CMD as administrator) type command (without square brackets) [sc delete yourservicename]
25.To install service again go to 16 or 17


这篇关于Windows服务问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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