Self running timer on Webservice??

C

Christina Haller

Hi
Is it possible to do something like that:
1. there is a file located on my website
2. I would like to start a webservice that copies that file each 24 hours to
a backup dir on the website
3. The webservice should be self running (without a client connection)

Until now, I tried the following stuff, but the timer does not run when i
call the method starttimer! I was thinking that the modal variable mVal will
count up on each timer_tick and the stoptimer returns then the amount of
ticks done. But nothing comes back.

Any idea?? Thanks

1. Builded a webservice containing 2 Methods and 1 Timer
Public mVal As Long

<WebMethod()> _

Public Function StartTimer() As String

Timer1.Interval = 1000

Timer1.Start()

StartTimer = CStr(mVal)

End Function

<WebMethod()> _

Public Function StopTimer() As String

Timer1.Stop()

StopTimer = CStr(mVal)

End Function

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick

mVal = mVal + 1

End Sub
 
D

Dan Rogers

This isn't going to work. What you may want to consider is creating an NT
service to do this - as this is more closely suited to the kinds of things
you would choose service instead of web-service to do.

Web services are stateless - so a call to one method won't carry over to
the next method call. If enough time passes, the thread will time out. In
fact, if you are just creating a normal time on a web service thread, and
then returning, when that thread is reharvested, it's timer will get
orphaned (and eventually croak).

--------------------
 
C

Christina Haller

Ok, that was what i assumed.
Because the webserver is not mine, I cant install any software on it.
But if found another solution for doing my (automated) backup.

Thanks anyway.
 
C

Christina Haller

What was the other solution you found? I tried creating a pair of
webservices that accept a target URI to "signal" every given period for
a given total duration. These two services pass the state info back and
forth in their arguments and then send a "signal" (request) to wake up
the main web service. While the ping-ponging works, my threads still
randomly die (sometimes a few minutes, sometimes after 40 minutes of
ping-pong

Hopefully you found something else that works cause I am getting pretty
frustrated with having my threads just die.

I could not find a solution for the webservice.After I brought down my
Webspace Provider once :-s, I changed the approach. Instead of having a
continuosly running service on the webserver, I create my backup of the
database when the first user (per day) is login in to the application and
send via email to my workplace;-). That means, if someone changes data,
automatically the database has been saved once per day.

That replaces my need of the webservice.

Until now, I couldnt figure out the webservice stuff. It's really
complicated, but I think it has to do with the asynchronous call of the
webservice. If I find a solution, I'l post it here of course.

cheers
c.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top