Click here to Skip to main content
15,886,023 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have a question I hope someone can answer. It is possible to create a webservice that loads data into memory and use a timer with that data? You see I created a program that reads from a file every five seconds and displays the data within the file after those five seconds but now I want to turn this into a webservice. Is this possible? If this is a stupid question I sincerely apologise
Posted
Comments
AndrewCharlz 18-Mar-14 7:42am    
yeah sure, its possible to create a ws to load data into a memory and later you can use that data using any application..

suppose if u would like to refresh that data for every 5 sec all ull have to do is call that web service for every 5 sec . is that clear
so u want a webservice to load data into ur common memory am i right
Ankur\m/ 18-Mar-14 8:06am    
Are you talking about a windows service here? Both are different. From your question it seems you want a windows service. If that is the case, yes, it can be implemented as a windows service.

1 solution

Hi,

Yes this is achievable, you could create a web service that reads the data from the file and stores in variable(s)/Model.
- The timer_tick method would execute code to read the file contents and store the contents in a static variable.
- When the web service method is is invoked, you return the contents of the static variable.

Note, the web service isn't a good place to code a timer. If there's code to execute every 5 seconds, your best bet is to go with a Windows service with a Timer executing your code 5s(Read the file); the contents of the file can be saved in a Data store(SQL Server) and the Web service would just read the latest data from the Data Store.
 
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