Error when starting Web Client in DEBUG

B

bixbarton

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
 
B

bixbarton

Figured out the solution to it myself.

When running in DEBUG, ASP.NET sticks a VsDebuggerCausalityData section
into the request.

This isn't always handled by the web service.

To turn off this section you need to add the following to your
applications CONFIG file.

<system.diagnostics>
<switches>
<!-- <add name="SwitchName" value="4"/> -->
<add name="Remote.Disable" value="1" />
</switches>
<trace autoflush="false" indentsize="4"/>
<!-- <assert assertuienabled="true" logfilename=".\TraceLog.txt"/>
-->
</system.diagnostics>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,738
Latest member
JinaMacvit

Latest Threads

Top