Mark,

Set the KeepAlive property to false on your instance
of the HttpWebRequest class. In the case of a SOAP
proxy you need to override the GetWebRequest method
to customise how it handles the request.

                protected override WebRequest GetWebRequest(Uri uri)
                {

                        // Declare locals.
                        HttpWebRequest request = null;

                        // Grab the instance of the request that will
                        // used to service this call and tell it not
                        // to keep the connection alive.
                        request =
(HttpWebRequest)base.GetWebRequest(uri);
                        request.KeepAlive = false;

                        // Return the request object.
                        return request;

                }

Hope this helps.

----------------------------------------
- Mitch Denny
- [EMAIL PROTECTED]
- +61 (414) 610-141
-

-----Original Message-----
From: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED]] On Behalf Of Mark Vatsaas
Sent: Wednesday, 3 July 2002 00:01
To: [EMAIL PROTECTED]
Subject: [ADVANCED-DOTNET] Can you disable or bypass connection groups?


I tried this in the web forum to no avail, so I'll try here.

I'm trying to write a test application to test my web services. The
logical method is to add a web reference to get the proxy generated, and
then create and call the proxy. This part is trivial.

By default, .NET uses Connection Groups for the socket connections used
by the proxy to talk to the server. As an example, assume that my test
application will make 100 web service method calls one at a time (no
multiple calls in parallel). These calls will all use the same socket.
Under most conditions, this would be a sensible thing to do. However, it
doesn't necessarily mirror real life in that my clients will likely not
be issuing 100 transactions on the same socket. This is true whether I
use the same proxy object instance for all 100 calls, or a new instance
for each call.

So, I started looking at how to tell .NET to use a new socket on each
request. If I set the ConnectionGroupName property to a unique value
with every call, then a new socket gets opened for each call. However,
the sockets don't get closed and I end up with 100 open sockets by the
end of my test. This isn't what I want, either.

How do I force .NET to give me the behavior I want?

You can read messages from the Advanced DOTNET archive, unsubscribe from
Advanced DOTNET, or subscribe to other DevelopMentor lists at
http://discuss.develop.com.

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to