Windows Service Stream issue

  • Thread starter Thread starter cjohnson275
  • Start date Start date
C

cjohnson275

Hi,

I have some code that uses HttpWebRequest to request data from an
Internet site, performaing a "screen-scraping" of an html page textual
data. I then use the HttpWebResponse.GetResponseStream() to retrieve
the data as a stream.

I put this stream into a MemoryStream, and I use a StreamReader object
to read the contents and write to a temp file on the local system.

I have this code within a C# class that if I call the method from a
windows application form, successfully runs to completion and retrieves
all the data from the html web page. But if I put this as part of a
Windows service, the data retrieved gets cut-off, consistently at the
same point. This leads me to believe it's a buffer size issue, but
increasing the memorystream buffer size does not impact?

Why does the same code run as a Service and through a windows form have
different results? Is there some limitations of using streams in a
windows Service?

Thanks for your help.

CJ
 
How do you retrieve data from ResponseStream?

Are there any errors, when your data is being "cut-off"?

Enable Network Tracing in order to see if the data was received by you.
 
Back
Top