如何将.exe程序转换为Windows服务 [英] How to Convert a .exe program to windows Service

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

问题描述

Hai,



我使用win-forms和C#在.net中创建了一个应用程序,现在我想转换为Windows服务。任何人都有这个想法。这不是控制台应用程序。





先谢谢

解决方案

创建Windows服务类型的新项目,并将现有代码复制到其中。您可能还需要为该服务创建一个安装程序项目。

注意:您不能在Windows服务中使用任何表单。



查看这篇关于服务的cp文章:简单Windows服务示例 [ ^ ]


Windows服务没有UI,因此,您必须取出与用户界面相关的所有内容。



这意味着您必须重新构建应用程序并将其分解为UI端和服务器侧。



您必须为这两方建立通信协议才能通过。



这是这不是一件小事。


在你的问题中,你需要解释你的exe文件的工作情况,这不是足够的证据。



你好朋友,如果您的exe文件源将基于任何UI(如文本框等)控件,那么将无法将相同的代码转换为Windows服务,因为Windows服务没有UI。



其他明智的,如果它提供某种服务,如从数据库获取数据并执行一些操作并对数据库进行更改..或在日期和时间基础上一些工作,那么你的相同代码将转换为windwos服务..

Hai,

I created a application in .net using win-forms and C# now i want to convert in to a windows service . Any one have idea about this . This is not a console application.


Thanks in Advance

解决方案

Create a new project of type Windows Service and copy the existing code into it. You may also have to create an installer project for the service.
NOTE: You can't use any forms in a windows service.

Check out this cp article about services: Simple Windows Service Sample[^]


Windows services have no UI, so you will have to take out everything that is user interface related.

This means you will have to re-architect your application and break it up into UI side and server side.

You will have to create a communication protocol for these two sides to talk through.

This is not a trivial undertaking.


Its not sufficeint expalnation in your question you need to explain what your exe file work..

Hello friend if your exe file source will based on any UI (like textbox ect) control then it will be not possibel to convert that same code to windows service because windows service has no UI.

other wise if it is provide some kind of service like take data from database and perform some operation and make changes to database.. or on the dateand time base some work then your same code will converted in windwos service...


这篇关于如何将.exe程序转换为Windows服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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