C#中的Windows Servcie [英] Windows Servcie in C#

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

问题描述

我有一个窗口服务器。 Currenlty在我的本地服务器上运行。



现在我有了一些新的要求,我修改了服务代码。现在我有了新的服务代码的EXE文件。我想要将该exe文件用于已经运行的窗口服务。



为此,我只是停止正在运行的servcie,然后用新修改的exe文件替换现有的EXE文件。然后启动servcie。



所以我的问题是,它是在Windows servcie中使用修改过的exe而不卸载servcie的正确方法吗?并且它是否正常工作?



还建议我正确的工作解决方案。



谢谢

I have a window servcie. Currenlty its running on my local server.

Now i have some new requirement and i modified the service code.Now I have new EXE file for the servcie.I want to use that exe file for the window servcie that is already running.

So for that I just stop the running servcie and then replace the existing EXE file with new modified exe file. And then start the servcie.

So my question is, IS it the right way to used modified exe in windows servcie without uninstalling the servcie? and also is it working fine or Not?

Also suggest me the proper working solution.

Thanks

推荐答案

是的,只要服务名称保持不变就是你要做的。



如果你想要更具冒险精神,你可以为你的功能和一个简单的加载器(通过反射)创建一个DLL,并让加载器复制一个更新文件(如果它在重启时存在)。这样一来,这个过程就是自动化的,就像服务重启一样简单。
Yes, as long as the service name stays the same that is what you have to do.

If you want to be more adventurous you can create a DLL for your functionality and a simple loader (through reflection) and have the loader copy an update file if it exists on a restart. That way the process is automated and as simple as a service restart.


我们应该卸载并重新安装服务。

我们可以从程序中手动完成默认窗口(只搜索它)。或者我们可以创建一个自动卸载以前版本的服务安装程序,并从.bat文件或命令行调用它。



查看此博客中的所有选项发布:http://candordeveloper.com/2012/12/28/simple-installer-for-windows-service-using-visual-studio-2012/
We should uninstall and reinstall the service.
We can do that manually from the Programs and Defaults window (just search for that). Or we can create a service installer that uninstalls the previous version automatically and call that from a .bat file or from the command line.

See all these options in this blog post: http://candordeveloper.com/2012/12/28/simple-installer-for-windows-service-using-visual-studio-2012/


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

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