Windows services vs winforms issue ..... 
Author Message
 Windows services vs winforms issue .....

Ok Ive got a question that is haunting me.

I have built a VERY simple application to hit an internal webpage
every 30
seconds, this page executes a bunch of ADO commands, and it changes,
hence Ive put it in a web page, it works perfectly.

I built a winforms application with a timer that does the following.

    Function DownloadPage(ByVal sCompleteURL As String) As String
        Dim wDownload As System.Net.WebClient = New
System.Net.WebClient()
        Dim bHTML As Byte() = wDownload.DownloadData(sCompleteURL)
        Dim sWebPage As String =
System.Text.Encoding.ASCII.GetChars(bHTML)
        Return sWebPage
    End Function

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

        Try
        DownloadPage("http://localhost/smoa/ed.asp")
        Catch
        ' Here I am going to send an alert if there was an error.
        End Try

    End Sub

Works like a charm........

NOW When I build it as a service and set the timer to 30 seconds (same
as winforms)

I does ABSOLUTTLEY NOTHING, it runs as a service fine, it installs
fine, it just does nothing ....

I Have built and rebuilt it and same results, I have built services
under VB.NET before and they are all running along happily this one
just does not.

Can anyone see a reason as to why it would work fine on a form but not
as a service ?

I am turning the timer on on_start I can see a blip in my cpu on
schedule, it just doesnt do anything.

Any Ideas ?????

Chris



Tue, 20 Sep 2005 04:42:24 GMT  
 Windows services vs winforms issue .....


Quote:

> I does ABSOLUTTLEY NOTHING, it runs as a service fine, it installs
> fine, it just does nothing ....

Unless you changed it, the service will run under the LocalSystem account.  
Does that account have sufficient permissions to do what you want?  If you
set the service to log on as yourself, does it work then?

Chris

--
If you don't like lunchmeat, please remove it from my e-mail address to
send me an e-mail



Tue, 20 Sep 2005 22:34:18 GMT  
 Windows services vs winforms issue .....
Nope, tried it BOTH ways, same result.

But thanks for the tip,

It had permissions, so just for kicks and grins I changed it to my user
and same result .......nada......

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Wed, 21 Sep 2005 00:27:13 GMT  
 Windows services vs winforms issue .....

Quote:
> Nope, tried it BOTH ways, same result.

> But thanks for the tip,

> It had permissions, so just for kicks and grins I changed it to my user
> and same result .......nada......

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!

Is it set to allow interaction with the desktop?  Which timer are you
using?  The System.Windows.Forms.Timer?  System.Threading.Timer?  Have you
tried a different timer?

Chris

--
If you don't like lunchmeat, please remove it from my e-mail address to
send me an e-mail



Wed, 21 Sep 2005 02:05:09 GMT  
 Windows services vs winforms issue .....

Well, I dono, to be completley honest.

I followed a tutorial a while back on DevX and it just said drag the
timer from the toolbar.

Always worked before for other apps, I will have to check the interact
with desktop, but is it really doing that with my code ?

Which is the correct timer ?

And is it visible and on what toolbar or do I need to add a refrence ?

I appreciate the help.

Chris

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Wed, 21 Sep 2005 06:14:17 GMT  
 Windows services vs winforms issue .....

Quote:

> Well, I dono, to be completley honest.

> I followed a tutorial a while back on DevX and it just said drag the
> timer from the toolbar.

> Always worked before for other apps, I will have to check the interact
> with desktop, but is it really doing that with my code ?

> Which is the correct timer ?

> And is it visible and on what toolbar or do I need to add a refrence ?

> I appreciate the help.

> Chris

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!

I'm 100% sure either, but I believe that if you use the
System.Windows.Forms.Timer, then it will not work if the service is not
allowed to interact with the desktop.  I would recommend using the
System.Threading.Timer to see if that worked.

Chris

--
If you don't like lunchmeat, please remove it from my e-mail address to
send me an e-mail



Wed, 21 Sep 2005 07:49:30 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Windows Service Time issue

2. .NET vs Java (Windows service development)

3. VS.NET, WinForms, Design, & the Red X

4. VS.NET, WinForms, Design, & the Red X

5. Service description for Windows Service

6. Windows Service in VB.NET - Failed to process service command

7. NT Service: An OLE Control for Creating Windows NT Services in Visual Basic (MSDN article)

8. NT Service: An OLE Control for Creating Windows NT Services in Visual Basic (MSDN article)

9. NT Service: An OLE Control for Creating Windows NT Services in Visual Basic (MSDN article)

10. Windows 95 B, Setup Wizard Issues Setup.EXE on Windows 95 A

11. Windows 95 B, Setup Wizard Issues Setup.EXE on Windows 95 A

12. Launch Windows form, from a Windows Service Application

 

 
Powered by phpBB® Forum Software