Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Self running timer on Webservice??

Reply
Thread Tools

Self running timer on Webservice??

 
 
Christina Haller
Guest
Posts: n/a
 
      02-11-2005
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



 
Reply With Quote
 
 
 
 
Dan Rogers
Guest
Posts: n/a
 
      02-15-2005
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).

--------------------
>From: "Christina Haller" <>
>Subject: Self running timer on Webservice??
>Date: Fri, 11 Feb 2005 11:47:59 +0100
>Lines: 48
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
>X-RFC2646: Format=Flowed; Original
>Message-ID: <>
>Newsgroups: microsoft.public.dotnet.framework.aspnet.webservic es
>NNTP-Posting-Host: line-zh-102-249.adsl.econophone.ch 212.53.102.249
>Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP10.phx.gbl
>Xref: TK2MSFTNGXA01.phx.gbl

microsoft.public.dotnet.framework.aspnet.webservic es:5490
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservic es
>
>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
>
>
>
>


 
Reply With Quote
 
 
 
 
Christina Haller
Guest
Posts: n/a
 
      02-17-2005
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.


"Dan Rogers" <> wrote in message
news:...
> 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).
>
> --------------------
>>From: "Christina Haller" <>
>>Subject: Self running timer on Webservice??
>>Date: Fri, 11 Feb 2005 11:47:59 +0100
>>Lines: 48
>>X-Priority: 3
>>X-MSMail-Priority: Normal
>>X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
>>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
>>X-RFC2646: Format=Flowed; Original
>>Message-ID: <>
>>Newsgroups: microsoft.public.dotnet.framework.aspnet.webservic es
>>NNTP-Posting-Host: line-zh-102-249.adsl.econophone.ch 212.53.102.249
>>Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP10.phx.gbl
>>Xref: TK2MSFTNGXA01.phx.gbl

> microsoft.public.dotnet.framework.aspnet.webservic es:5490
>>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservic es
>>
>>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
>>
>>
>>
>>

>



 
Reply With Quote
 
Christina Haller
Guest
Posts: n/a
 
      03-08-2005

> 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.



>
>
>
> --
> taliesin77
> ------------------------------------------------------------------------
> Posted via http://www.codecomments.com
> ------------------------------------------------------------------------




>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing self: if self is a tree how to set to a different self Bart Kastermans Python 6 07-13-2008 11:19 AM
__autoinit__ (Was: Proposal: reducing self.x=x; self.y=y;self.z=z boilerplate code) falcon Python 0 07-31-2005 05:41 PM
Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y;self.z=z boilerplate code) Ralf W. Grosse-Kunstleve Python 2 07-12-2005 03:20 AM
Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code Ralf W. Grosse-Kunstleve Python 16 07-11-2005 09:28 PM
__autoinit__ (Was: Proposal: reducing self.x=x; self.y=y;self.z=z boilerplate code) Ralf W. Grosse-Kunstleve Python 18 07-11-2005 04:01 PM



Advertisments