有什么方法可以回收Windows服务中托管的WCF服务? [英] Is there any way to recycle a WCF service hosted in Windows service?

查看:105
本文介绍了有什么方法可以回收Windows服务中托管的WCF服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了WCF服务,希望将其作为Windows服务托管.不幸的是,我的WCF服务会产生一些内存泄漏(它使用第三方组件,因此我无法解决此问题).我希望能够不时地回收服务.我可以使用Windows服务吗?我不想迁移到IIS或WAS,因为我想在XP计算机上托管该服务.

I''ve developed a WCF service which I''d like to host as Windows service. Unfortunately my WCF service produce some memory leaks (it uses third-party components so I can''t fix this). I''d like to have an ability to recycle a service time to time. Can I do it with windows service? I wouldn''t like to move to IIS or WAS, as I want to host the service on XP machine.

推荐答案

我曾经遇到过完全相同的问题.我通过在预定的时间间隔内使用计划任务运行批处理文件来修复该问题,该文件停止并重新启动了该服务.我认为它是这样的:

I faced exactly the same problem once. I fixed it by running a batch file using Scheduled Tasks on a defined interval that stopped and restarted the service. I think it went something like this:

net stop [ServiceName Here]
net start [ServiceName Here]



它不是很漂亮,但是可以.



It wasn''t pretty, but it worked.


在Windows服务中,没有回收的概念.很久以前,我们有类似的情况.我们所做的是,我们创建了服务监视器.服务监视器负责启动/停止和回收主要服务.
In windows service there is no notion of recycling. We had similar situation long time back. What we did was, we created service monitor. The service monitor was responsible for starting/stopping and recycling the main service.


这篇关于有什么方法可以回收Windows服务中托管的WCF服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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