关于VB.NET Windows服务 [英] About VB.NET Windows Service

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

问题描述

我已经在VB.NET中开发了我的应用程序.我想将Windows应用程序作为Windows服务运行.我正在应用程序中调用许多dll,并将应用程序与Oracle等连接.

现在,请帮助我如何将Windows应用程序作为Windows服务运行,并且该应用程序在运行时应该对用户可见...

在此先感谢

I have developed my application in VB.NET. I want to run windows application as windows service. I am calling many dlls in my application and connecting application with Oracle etc.

Now please help me how to run Windows application as Windows Service and the application should be viewable to user when it is running...

Thanks in advance

推荐答案

在Vista和Windows 7中,无法将WinForms应用程序作为Windows服务运行.您必须创建一个实际的Windows Service应用程序(这意味着不能使用任何界面元素).

[
In Vista and Windows 7, it''s not possible to run a WinForms app as a Windows service. You have to create an actual Windows Service application (which means any interface elements cannot be used).

4.5 million Google serach results for ".net windows service tutorial"
[^]


您不能那样做. Windows Service应用程序根本不应该显示用户界面.您不能将所有Windows应用程序作为服务运行,并且不能期望它们能正常工作.由于它们无法显示用户可以看到的用户界面,因此如果应用程序正在等待用户执行某项操作,则它将永远不会发生.

针对这种类型的环境正确地重写您的应用程序. Server应用程序应自主完成它的工作,如果您需要用户告诉它该怎么做,请编写另一个与服务进行通信的应用程序(例如通过命名管道或其他进程间通信方法)来告知它该怎么办.
You can''t do that. Windows Service applications should not show a user interface at all. You cannot run all Windows Applications as a service and expect them to work. Since they cannot show a user interface that the user can see, if the app is waiting for the user to do something, it''ll never happen.

Rewrite your app properly for this type of environment. The Server app should do it''s work autonomously and if you need the user to tell it what to do, write a second application that communicates with the service, such as through a named pipe or some other interprocess communication method, to tell it what to do.


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

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