Error when starting Web Client in DEBUG

Tech-Archive recommends: Fix windows errors by optimizing your registry



Running C# .NET 1.1

I'm experiencing a weird oddity.

We have a client app which access the webservice at
http://www.test.planningportal.gov.uk/soap/servlet/messagerouter

If I start the client with no debugging it's fine.

But if I start the client with debuggin on, when it Invokes a method on
the webservice you get an exception saying "The underlying connection
was closed: An unexpected error occurred on a send."

I've searched online and all the results so far talk about how you need
to override the WebRequest method and stick a KeepAlive = false in
there.

protected override WebRequest GetWebRequest(Uri uri)
{
HttpWebRequest request = (HttpWebRequest)base.GetWebRequest(uri);
request.KeepAlive = false;
return request;
}

I've tried this, even accounting for the fact that the webservice is
using SOAP. But still no joy.

I also found another variation on the concept shown below;

protected override WebRequest GetWebRequest(Uri uri)
{
WebRequest request = base.GetWebRequest(uri);

if (requestPropertyInfo == null)
{
System.Type sType = request.GetType();
requestPropertyInfo = sType.GetProperty("WebRequest");
}

if (requestPropertyInfo != null)
{
HttpWebRequest webRequest =
(HttpWebRequest)requestPropertyInfo.GetValue(request, null);
webRequest.KeepAlive = false;
}
return request;
}

But also this doesn't help. requestPropertyInfo ends up containing a
null and so the GetValue never gets called.

Does anyone have an idea?

Krs
Chris

.



Relevant Pages

  • Error when starting Web Client in DEBUG
    ... We have a client app which access the webservice at ... If I start the client with no debugging it's fine. ... protected override WebRequest GetWebRequest ... HttpWebRequest request = base.GetWebRequest; ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: Get an error when post soap message
    ... you have an ASP.NET webservice and a certain client ... creating a webservice client proxy ... we can use some trace tools such as the Soap Tookit's Trace Utility ... >>or other http trace tool to capture the webservice's SOAP request message ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: Calling a webmethod by a post
    ... That is a GET request, ... > i have an webservice created with .NET, and a client want to consume it ... but this way my webservice crash. ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • How to configure client to make DIME request?
    ... How do I configure the client to make a request to a WebService which ... instantiating the WebService and calling the method, ... service method call from the client side. ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • Re: Error when starting Web Client in DEBUG
    ... We have a client app which access the webservice athttp://www.test.planningportal.gov.uk/soap/servlet/messagerouter ... If I start the client with no debugging it's fine. ... protected override WebRequest GetWebRequest ... HttpWebRequest request = base.GetWebRequest; ...
    (microsoft.public.dotnet.framework.aspnet.webservices)