反复将数据从Windows服务传输到控制台应用程序 [英] Transfer data from Windows Service to Console Application repeatedly

查看:57
本文介绍了反复将数据从Windows服务传输到控制台应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的情况,我有一个Windows服务,该服务每20分钟运行一次任务,任务是:从远程网站托管的API请求更新.

Here is my scenario, I have a windows service that runs a task every 20 minutes, the task is: requesting updates from an API hosted by a remote website.

响应是JSON对象的列表,当Service接收到该列表时,它将执行一组操作,然后追加更多JSON对象,最后,该服务必须将该列表推送到正在运行的控制台应用程序.

The response is a list of JSON objects, When the Service receives the list, it carries out a set of operations then appends more JSON objects, finally the service must push the list to a running console application.

我的具体问题是:如何将数据从Windows服务直接直接传输到控制台应用程序和

My very specific question is: how to transfer this data from the windows service to the console App both directly and professionally

直接 是指没有中间解决方案,例如写入临时文件或保存在SQL表中……等等.

By directly I mean without intermediate solution like writing in a temp file or saving in SQL table ... etc.

专业地"是指最佳的最佳解决方案,尤其是在没有从服务到控制台应用程序的p/Invoke调用的情况下.

By professionally I mean the best optimal solution especially without p/Invoke from the service to the console App.

推荐答案

您肯定需要一种媒介来在这两个进程之间进行通信.可以在同一系统上以多种方式完成通信.

You would definitely need a medium to communicate between these two processes. The communication can be done in a lot of ways on the same system.

有了您在问题"中的解释,它看起来像是一种单向沟通.可能是您可以通过套接字(原始级别)进行进程间通信,也可以是使用消息传递框架进行通信(WCF/SignalR),或者甚至可以使用消息队列系统(MSMQ/RabbitMQ)等.

With your explanation in Question it looks like one way communication. May be you can go for Inter-process communication via sockets(raw level) or Use a messaging framework for communication(WCF/SignalR) or you can even use a Message Queue system(MSMQ/RabbitMQ) etc.

如果您可以缩小问题范围,则可以获得特定的答案.

You can get a specific answer if you can narrow down your question.

这篇关于反复将数据从Windows服务传输到控制台应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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