Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Error when starting Web Client in DEBUG

Reply
Thread Tools

Error when starting Web Client in DEBUG

 
 
bixbarton
Guest
Posts: n/a
 
      12-08-2006
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.u.../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(reque st, 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

 
Reply With Quote
 
 
 
 
bixbarton
Guest
Posts: n/a
 
      12-08-2006
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>


On Dec 8, 10:39 am, "bixbarton" <bixbar...@gmail.com> wrote:
> Running C# .NET 1.1
>
> I'm experiencing a weird oddity.
>
> 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.
>
> 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(reque st, 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
3 ESSENTIAL TOOLS FOR STARTING AND MAINTAINING...3 ESSENTIAL TOOLSFOR STARTING AND MAINTAINING...3 ESSENTIAL TOOLS FOR STARTING ANDMAINTAINING... Oanh Bui C++ 0 04-27-2009 12:51 PM
3 ESSENTIAL TOOLS FOR STARTING AND MAINTAINING...3 ESSENTIAL TOOLSFOR STARTING AND MAINTAINING...3 ESSENTIAL TOOLS FOR STARTING ANDMAINTAINING... Oanh Bui C Programming 0 04-27-2009 12:51 PM
3 ESSENTIAL TOOLS FOR STARTING AND MAINTAINING...3 ESSENTIAL TOOLSFOR STARTING AND MAINTAINING...3 ESSENTIAL TOOLS FOR STARTING ANDMAINTAINING... Oanh Bui Python 0 04-27-2009 12:46 PM
debug="false" in web.config and <%@ debug="true" ...%> in aspx file => true or false? André ASP .Net 3 08-28-2006 12:02 PM
Config Mgr Debug/Release and Web.config Compilation debug=true RonL ASP .Net 0 04-08-2006 03:50 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57