在ASP .NET中创建侦听器的最佳方法是什么? [英] What are the best ways to create a listener in ASP .NET

查看:78
本文介绍了在ASP .NET中创建侦听器的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ASP .NET中创建监听器的最佳方法是什么?

我有来自API的数据(发送GPS数据 - post方法).Data在 JSON 格式。



现在我想通过写任何服务/监听器/或任何其他方法来获取数据并将其保存在我的数据库中,这样我就可以继续听2至3个小时,并自动保存数据。

响应机构是:

What are the best ways to create a Listener in ASP .NET?
I have Data coming from API (Sending GPS data - post method).Data is in JSON format.

Now i want to take the data and save it in my Database by writting any service / listener / or any other method so that i can keep listen every 2 to 3 minitus and save the data autometically.
The Response Body is:

{
"unitCodes": [
  19224,
  19245,
  19219,
  19240
],
"start":"2018-03-02T00:59:00.000Z",
"end":"2018-03-02T01:00:00.000Z",
"fields": [
  "unitCode",
  "timedate",
  "latitude",
  "longitude",
  "ignition",
  "velocity",
  "positionerror",
  "digitherm5"
]
}



有没有办法实现这个?请有人帮我解决这个问题。



我的尝试:



我试过编写一个控制台应用程序,我没有得到回复,也不确定如何查找数据。


Is there any way to achieve this??? Please some one help me out on this.

What I have tried:

I have tried with writing a console application and im not getting response back and not sure how to catch up the data.

推荐答案

你可以试试看< a href => [ ASP.NET SignalR ]在一定时间内推送数据。请参阅:与ASP.NET SignalR推送服务集成 [ ^ ]



如果你正在寻找作业调度员。有一些选项可用于在ASP.NET中实现和运行预定作业。一些受欢迎的有Quartz.Net,FluentScheduler和HangFire。



这里有一些很好的例子可以帮助你入门:

(1)使用Quartz.Net ASP.NET中的计划任务 [ ^ ]

(2)在ASP.NET核心中使用Hangfire安排后台作业 [ ^ ]



否则,如已建议,你可以创建并运行一个Windows服务来执行此操作。
You may try looking at [ASP.NET SignalR] to push data in a certain time. See: Integrating with ASP.NET SignalR push services[^]

If you are looking for a job scheduler. There are a few options that are out there which can use to implement and run scheduled jobs in ASP.NET. Some of the popular out there are Quartz.Net, FluentScheduler and HangFire.

Here are some great examples that might help you get started:
(1)Scheduled Tasks In ASP.NET With Quartz.Net[^]
(2)Schedule Background Jobs Using Hangfire In ASP.NET Core[^]

Otherwise, as already suggested, you could create and run a windows service to do this.


这篇关于在ASP .NET中创建侦听器的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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