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

WebException not caught while running on Vista but is caught on XP

P: n/a
Simplifying the code a bit its like this:

try
{
myRemotingObj.Myfunction(string, string,string,string,timeSpan)
}
catch(WebException)
{
commsUp = false;
}

Using .NET Framework v2.0 and C# and my own service running on my LAN, I
call a function in my .NET remoting object inside of a try catch, we unplug
the LAN at random to test that it fails gracefully into the
catch(WebException){}

Running on Vista it seems to go right past the catch and dutifully reports a
System.Net.WebException (see below).

The exact same test on Windows XP fails gracefully into the WebException.

We are using Vista Business edition.

The purpose of the catch WebException is really to try to differentiate a
loss of communications from other errors, so I know when to try and establish
the connection again and so I can tell the user communications is down, OR
instead tell the user what the other error is and leave comms up.

6/26/2007 10:36:57 AM Error MCSD-Vista
ERROR! State/File Move:Thread Crash (see log) - Will Retry in 5sec
The request timed out.System.Net.WebException: The request was aborted: The
operation has timed out.
at System.Net.HttpWebRequest.GetResponse()
at
System.Runtime.Remoting.Channels.Http.HttpClientTr ansportSink.ProcessMessage(IMessage
msg, ITransportHeaders requestHeaders, Stream requestStream,
ITransportHeaders& responseHeaders, Stream& responseStream)
Server stack trace:
at
System.Runtime.Remoting.Channels.Http.HttpClientTr ansportSink.ProcessResponseException(WebException webException, HttpWebResponse& response)
at
System.Runtime.Remoting.Channels.Http.HttpClientTr ansportSink.ProcessMessage(IMessage
msg, ITransportHeaders requestHeaders, Stream requestStream,
ITransportHeaders& responseHeaders, Stream& responseStream)
at
System.Runtime.Remoting.Channels.SoapClientFormatt erSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleRe turnMessage(IMessage
reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateI nvoke(MessageData&
msgData, Int32 type)
at MiTekAUS.ProdService.p.a(String A_0, String A_1, String A_2, String
A_3, String A_4, TimeSpan A_5)
at MiTekAUS.ProdService.v.a(String A_0, String A_1, String A_2, String
A_3, String A_4, String A_5, TimeSpan A_6)
at MiTekAUS.OptiFlow.n.d()
Jun 26 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a

"Philip K" <Ph*****@discussions.microsoft.comwrote in message
news:F7**********************************@microsof t.com...
Simplifying the code a bit its like this:

try
{
myRemotingObj.Myfunction(string, string,string,string,timeSpan)
}
catch(WebException)
{
commsUp = false;
}
catch(System.Net.WebException)
{
commsUP = false
}
So why can't you use multiple Catches in the try/catch block?

Jun 26 '07 #2

P: n/a
Hi thanks for your reply

The first catch is already a System.Net.WebException (according to the
intelisense help in the IDE). So unless I missed the point addin the other
catchdoes not seem to be the answer.

Also the code already works in Windows XP

Also I dont know what else I would need to catch to only detect a comms
failure, as far as I understand WebExecption (which is
System.Net.WebException) is the exception I am getting based on what it says
in the error message.

"Mr. Arnold" wrote:
>
"Philip K" <Ph*****@discussions.microsoft.comwrote in message
news:F7**********************************@microsof t.com...
Simplifying the code a bit its like this:

try
{
myRemotingObj.Myfunction(string, string,string,string,timeSpan)
}
catch(WebException)
{
commsUp = false;
}
catch(System.Net.WebException)
{
commsUP = false
}

So why can't you use multiple Catches in the try/catch block?

Jun 26 '07 #3

P: n/a

"Philip K" <Ph*****@discussions.microsoft.comwrote in message
news:B7**********************************@microsof t.com...
Hi thanks for your reply

The first catch is already a System.Net.WebException (according to the
intelisense help in the IDE). So unless I missed the point addin the other
catchdoes not seem to be the answer.

Also the code already works in Windows XP

Also I dont know what else I would need to catch to only detect a comms
failure, as far as I understand WebExecption (which is
System.Net.WebException) is the exception I am getting based on what it
says
in the error message.
Obviously it's not working and you need to flip the script. If it works on
XP, it doesn't on Vista, and it's blowing past the exception, because
you're looking at a particular exception, then you need to do something
else.

1) catch(webexception)
2) follow it with catch(exception)

If it's coming to the catches then something blew.

I think if you hit the catch(exception) you can ask what type of an
exception it is and take the appropriate action.

Sometimes, one has to think outside the box.

Jun 26 '07 #4

P: n/a
I found that Vista throws:
RemotingTimeoutException where XP was throwing WebException so I caught this
in all 60 odd places where this occurs in my code, It still not sure why the
error I got said WebException in its text though.

What I really need is a tidy reliable way to see if the remoting connection
is down and needs to be restarted, I will look at using TrackingHandler
Disconnected object though I am not sure what the implications of its
requirement for SecurityPermissionsFlag.Infrastructure will be on my client
and the low level users who use it.

"Mr. Arnold" wrote:
>
"Philip K" <Ph*****@discussions.microsoft.comwrote in message
news:B7**********************************@microsof t.com...
Hi thanks for your reply

The first catch is already a System.Net.WebException (according to the
intelisense help in the IDE). So unless I missed the point addin the other
catchdoes not seem to be the answer.

Also the code already works in Windows XP

Also I dont know what else I would need to catch to only detect a comms
failure, as far as I understand WebExecption (which is
System.Net.WebException) is the exception I am getting based on what it
says
in the error message.

Obviously it's not working and you need to flip the script. If it works on
XP, it doesn't on Vista, and it's blowing past the exception, because
you're looking at a particular exception, then you need to do something
else.

1) catch(webexception)
2) follow it with catch(exception)

If it's coming to the catches then something blew.

I think if you hit the catch(exception) you can ask what type of an
exception it is and take the appropriate action.

Sometimes, one has to think outside the box.

Jun 27 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.