确切使用Windows服务和WCF [英] Exact use of windows service and WCF

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

问题描述

亲爱的所有人,



我从理论上知道什么是WCF和Windows服务,但有一件事我没有被清除,即如果需要我们可以把Windows服务的逻辑在WCF中,让我用下面的例子来解释一下:



每2分钟我需要检查一个有或没有任何信息的数据库表,如果它是然后收集所有信息并用于处理和删除收集的记录信息。类似地检查这个时间跨度为2分钟。



现在同样的逻辑我将放入WCF,我将创建一个ASPX页面,将使用一些重新加载2分钟计时器



setTimeout(function(){

window.location.reload(1);

} ,5000);

),

最后在页面加载中我将调用WCF。所以我的任务将结束。

我只是想知道场景/情况,其中只有Windows服务可以使用而不是任何WCF或Web服务。



你能否就此提出建议。



谢谢

Dear All,

I know what is WCF and Windows service theoretically, But one thing i am not cleared ie If required we can put the logic of windows service in the WCF, let me explain this with the below example:

For every 2 mins i need to check a database table which has any information or not, if it is has then collect all information and use it for processing and delete the collected records information. similarly check this with time span of 2 mins.

Now same logic i will put in the WCF, i will create a ASPX page which will reload for 2 mins using some Timers
(
setTimeout(function(){
window.location.reload(1);
}, 5000);
),
Finally in the page load i will call the WCF. So my task will be over.
I just want to know the scenarios/situation where exactly only windows service can be use not any WCF or web service.

Could you please suggest on this.

Thanks

推荐答案

根据您的要求我认为NetTcpBinding最适合WCF。



根据您的要求,如果您在WCF中使用NetTcpBinding并设置服务或使用Windows服务,两者都可以为您服务目的。



但是Windows服务会带来一些潜在的问题,比如服务依赖性,文件执行位置,用户帐户可访问性等等。



请查看以下链接。

http://www.montgomerysoftware.com/CreatingaWindowsServiceinC/tabid/164/language/en-US/Default.aspx [ ^ ]



谢谢。
As per your requirement I think that NetTcpBinding is best suitable in WCF.

As per your requirement, if you use NetTcpBinding in WCF and setup a service or use a windows service both can serve your purpose.

But windows service comes with some potential problems like service dependency, location of your file execution, user accounts accessibility etc.,.

check this link below.
http://www.montgomerysoftware.com/CreatingaWindowsServiceinC/tabid/164/language/en-US/Default.aspx[^]

Thanks.


我获得了更好的知识。如果我们使用Web方法,那么它将使用Req / Res消耗一些网络带宽。因此,不依赖于网络,您可以运行Windows服务,该服务将由操作系统管理,以便更好地处理您的逻辑。



因此任何连续运行的后台进程在分钟/小时内需要然后使用Windows服务



如果任何任务要执行每日/每月/每周,那么去调度程序



其他明智的WCF(可重用性)
I got the better knowledge in that ie. If we use Web means then it will consume some network bandwidth with Req/Res. So Instead of relies in the network you can run a Windows Service which will be managed by the OS so better handling of you logic.

So any background process which runs continuously required in the minutes/ hours then go with Windows Service

If Any task to be perform an Daily/Monthly/Weekly basis then go for Schedulers

other wise go with WCF(Re usability)


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

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