By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,294 Members | 1,568 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,294 IT Pros & Developers. It's quick & easy.

Problem with Windows Service and HttpWebRequest

P: n/a
Hello everyone I was wondering if anyone has come across my problem? I
programmed a Windows Service that uses httpWebRequest and httpWebResponse in
VB.NET. Everything works fine until I use the webresponse object. What the
Windows Service does is when the timer in the windows service elapses, the
request to the website is made and a response is retrieve in a simple
myhttpWebrequest.GetResponse(). I don't even do anything with the response,
and close out of the response immediately. But the Windows Service then
creates a connection for each call for the website and causes the memory to
increase to 30 MB. When I use a netstat on the server, I see multiple http
connections due to this Windows Service. I tried to set the timeout on the
myhttpWebRequest but it does nothing. Is there a way to make the
application to disconnect after the connection and call to the website has
been made? Thanks.
Aug 24 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Make sure you're calling Dispose on the response object when you're
done with it.

Bruce Dunwiddie
http://www.csvreader.com

msnews.microsoft.com wrote:
Hello everyone I was wondering if anyone has come across my problem? I
programmed a Windows Service that uses httpWebRequest and httpWebResponse in
VB.NET. Everything works fine until I use the webresponse object. What the
Windows Service does is when the timer in the windows service elapses, the
request to the website is made and a response is retrieve in a simple
myhttpWebrequest.GetResponse(). I don't even do anything with the response,
and close out of the response immediately. But the Windows Service then
creates a connection for each call for the website and causes the memory to
increase to 30 MB. When I use a netstat on the server, I see multiple http
connections due to this Windows Service. I tried to set the timeout on the
myhttpWebRequest but it does nothing. Is there a way to make the
application to disconnect after the connection and call to the website has
been made? Thanks.


Aug 24 '05 #2

P: n/a
Thank you for replying. For some reason I do not get a
myhttpWebResponse.Dispose method, I only get the Close method. Would you
have any suggestios please? Thanks.

"shriop" <sh****@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Make sure you're calling Dispose on the response object when you're
done with it.

Bruce Dunwiddie
http://www.csvreader.com

msnews.microsoft.com wrote:
Hello everyone I was wondering if anyone has come across my problem? I
programmed a Windows Service that uses httpWebRequest and httpWebResponse
in
VB.NET. Everything works fine until I use the webresponse object. What
the
Windows Service does is when the timer in the windows service elapses,
the
request to the website is made and a response is retrieve in a simple
myhttpWebrequest.GetResponse(). I don't even do anything with the
response,
and close out of the response immediately. But the Windows Service then
creates a connection for each call for the website and causes the memory
to
increase to 30 MB. When I use a netstat on the server, I see multiple
http
connections due to this Windows Service. I tried to set the timeout on
the
myhttpWebRequest but it does nothing. Is there a way to make the
application to disconnect after the connection and call to the website
has
been made? Thanks.

Aug 24 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.