Click here to Skip to main content
15,888,733 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I have a C# project that logging data into sql server database and monitor the real time data on windows form, the C# project read data from TCP/IP Devices over ethernet socket, where i send the command and read the response from stream every (1) sec. using windows form timer.
And the second timer interval = 5 (min) where the data saved in the sql server.
i want to convert this to asp.net to let user access the server over a website from any where.

what is the best way to do this in the server side when i using asp.net or from where can i start to connect and get data from devices as i did in C# project.

What I have tried:

I have tried the hangfire. but is there a butter way to run task in background.
Posted
Updated 11-Jul-18 2:44am

You can try quartz
[https://www.quartz-scheduler.net/]

But running a background task in Asp.net application is unreliable because it will only run if your web application has active requests or running.

I used windows service (C#) application to run background tasks
 
Share this answer
 
Comments
Member 13907307 11-Jul-18 9:30am    
Thank you.
But this service will included in the project ?
and how to make this service run continuously and how can i detect if the service is run correctly or stopped working?
sorry for the questions but i'm new in asp.net
Keviniano Gayo 11-Jul-18 10:46am    
The windows service is on a separate project.. You have to install it on the server.
It will run continuously, it will show in services (services.msc) in windows, and you can see the status if its running or stopped.

Or you could try "Solution 2" which i also used to trigger the task, just make sure the request is coming from pingdom when you deploy to production.
A cheap and easy method is to have a specific URL to trigger the task, and use a service such as PINGDOM to hit that specific URL.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900