473,406 Members | 2,208 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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

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
4 2108

"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
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

"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: etantonio | last post by:
Good morning, I've a problem, in the past I translate my site from google or altavista with a code similar to this : <%@ Page Language="c#" Trace="true" Debug="true" %> <%@ import...
3
by: A User | last post by:
Very strange - this code is copy and paste from the net and works on 2 of my 3 development machines - but of course not the machine I need to run it on. I've seen similar posts, but no solutions...
1
by: Chris Langston | last post by:
We are seeing a very frustrating intermittent problem. We are making Synchronious web service method calls from a .NET windows Service using the following syntax WebRequest.getResponse call it...
1
by: Tim Reynolds | last post by:
Team, From a windows service, we consume a web service on another server and occasionally receive System.Net.WebException: The underlying connection was closed:. For some clients we call, we do...
0
by: Seth Thibodeaux | last post by:
I have built a Windows Service that connects to Sql Server 2000 Reporting Services via its Web Service interface for the purpose of generating reports. Intermittently, calls made to the Web Service...
0
by: Shree | last post by:
While invoking the web service from client, I am setting the credentitals using the following code... ReportingService.Credentials = System.Net.CredentialCache.DefaultCredentials; But in...
2
by: Scott McFadden | last post by:
When I invoke two web service methods sequentially with no delay, the first web method invocation goes smooth while the 2nd one generates the dredded: System.Net.WebException: The underlying...
1
by: =?Utf-8?B?Q2lhcmFuIE8nJ0Rvbm5lbGw=?= | last post by:
On reflection, you could possibly make the app a self extracting zip file which extracts the EXE and a settings file and then starts the app, then when you app closes, it can repack the settings...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.