Link to home
Create AccountLog in
Avatar of Larry Brister
Larry BristerFlag for United States of America

asked on

WIndows Service Timeout and HttpWebRequest/Response

I have a Windows service that starts a series of threads on start

The threads each launch a HttpWebRequest in which the HttpWebResponse needs to never close.

However...
This is my Header on the request.
What can I change so the Response never closes?

            sendWebRequest.SendChunked = True
            sendWebRequest.Method = "POST"
            sendWebRequest.ContentType = "text/plain"
            sendWebRequest.KeepAlive = True
            sendWebRequest.UserAgent = "CometTest"
            sendWebRequest.ServicePoint.ConnectionLimit = 20
            sendWebRequest.Timeout = 43200
            sendWebRequest.ReadWriteTimeout = System.Threading.Timeout.Infinite

Open in new window

Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Has it started closing? How long does it stay open?
Avatar of Larry Brister

ASKER

CodeCruiser

Not counting startup...looks like the 43200    
12 hours

Then the service stops?

Anyway I can just restart?
Service stops or the webrequest stops? Yes you can restart.
CodeCruiser

I'm not experienced at Web Services at all.

So...should I make this two EE questions?

How do I restart the Windows service from inside itself?

How do I restart the Web Request?
I am confused as to what is stopping after 12 hours. Is the webrequest terminating or is the service stopping?
CodeCruiser

The web service is.  And I don't understand why

The only thing with a timer on it is the Web Request
>The web service is

You mean Windows service right?


>The only thing with a timer on it is the Web Request
And what is the duration of that timer?
CodeCruiser

I think I'm totally messing this conversation up

The Windows Service is stopping at the 43200 seconds point

I don't have an actual timer control at all

At no point am I telling the Windows Service to stop
I have no error message in the log

It simply stops at the 43200 point

The only place I have that is in the HttpWebRequest.

The HttpWebRequest Timeout is set in a sub

Blah..blah...blah...
Dim sendWebRequest As HttpWebRequest = CType(WebRequest.Create(stUrl), HttpWebRequest)

Then this

'Attach unique id so Response stream attaches to THIS request
            sendWebRequest.Headers.Add("ID: " + guid)

            'Web request Header
            sendWebRequest.SendChunked = True
            sendWebRequest.Method = "POST"
            sendWebRequest.ContentType = "text/plain"
            sendWebRequest.KeepAlive = True
            sendWebRequest.UserAgent = "CometTest"
            sendWebRequest.ServicePoint.ConnectionLimit = 1000
            sendWebRequest.Timeout = 43200
            sendWebRequest.ReadWriteTimeout = System.Threading.Timeout.Infinite
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Thanks