473,545 Members | 937 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Simplifying the code a bit its like this:

try
{
myRemotingObj.M yfunction(strin g, string,string,s tring,timeSpan)
}
catch(WebExcept ion)
{
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(WebExcept ion){}

Running on Vista it seems to go right past the catch and dutifully reports a
System.Net.WebE xception (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.Http WebRequest.GetR esponse()
at
System.Runtime. Remoting.Channe ls.Http.HttpCli entTransportSin k.ProcessMessag e(IMessage
msg, ITransportHeade rs requestHeaders, Stream requestStream,
ITransportHeade rs& responseHeaders , Stream& responseStream)
Server stack trace:
at
System.Runtime. Remoting.Channe ls.Http.HttpCli entTransportSin k.ProcessRespon seException(Web Exception webException, HttpWebResponse & response)
at
System.Runtime. Remoting.Channe ls.Http.HttpCli entTransportSin k.ProcessMessag e(IMessage
msg, ITransportHeade rs requestHeaders, Stream requestStream,
ITransportHeade rs& responseHeaders , Stream& responseStream)
at
System.Runtime. Remoting.Channe ls.SoapClientFo rmatterSink.Syn cProcessMessage (IMessage msg)

Exception rethrown at [0]:
at System.Runtime. Remoting.Proxie s.RealProxy.Han dleReturnMessag e(IMessage
reqMsg, IMessage retMsg)
at System.Runtime. Remoting.Proxie s.RealProxy.Pri vateInvoke(Mess ageData&
msgData, Int32 type)
at MiTekAUS.ProdSe rvice.p.a(Strin g A_0, String A_1, String A_2, String
A_3, String A_4, TimeSpan A_5)
at MiTekAUS.ProdSe rvice.v.a(Strin g A_0, String A_1, String A_2, String
A_3, String A_4, String A_5, TimeSpan A_6)
at MiTekAUS.OptiFl ow.n.d()
Jun 26 '07 #1
4 2118

"Philip K" <Ph*****@discus sions.microsoft .comwrote in message
news:F7******** *************** ***********@mic rosoft.com...
Simplifying the code a bit its like this:

try
{
myRemotingObj.M yfunction(strin g, string,string,s tring,timeSpan)
}
catch(WebExcept ion)
{
commsUp = false;
}
catch(System.Ne t.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.WebE xception (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.WebE xception) is the exception I am getting based on what it says
in the error message.

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

try
{
myRemotingObj.M yfunction(strin g, string,string,s tring,timeSpan)
}
catch(WebExcept ion)
{
commsUp = false;
}
catch(System.Ne t.WebException)
{
commsUP = false
}

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

Jun 26 '07 #3

"Philip K" <Ph*****@discus sions.microsoft .comwrote in message
news:B7******** *************** ***********@mic rosoft.com...
Hi thanks for your reply

The first catch is already a System.Net.WebE xception (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.WebE xception) 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(webexcept ion)
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:
RemotingTimeout Exception 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 SecurityPermiss ionsFlag.Infras tructure will be on my client
and the low level users who use it.

"Mr. Arnold" wrote:
>
"Philip K" <Ph*****@discus sions.microsoft .comwrote in message
news:B7******** *************** ***********@mic rosoft.com...
Hi thanks for your reply

The first catch is already a System.Net.WebE xception (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.WebE xception) 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(webexcept ion)
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
2222
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 Namespace="System.Net" %> <%@ import Namespace="System.IO" %> <script runat="server"> void Page_Load(Object Src, EventArgs E ) { if (!Page.IsPostBack)
3
3967
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 that work for me. Is it a problem with my proxy settings on this 1 machine? I have all the boxes unchecked for LAN Settings. Net browsing is fine....
1
2401
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 occasionally fails with the following error: 1) Exception Information ********************************************* Exception Type:...
1
3478
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 not see this as we ran into this previoulsy, made a posting, and received some suggested code to resolved. The code was put in their proxy classes...
0
2641
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 result in WebExceptions indicating that the underlying connection was closed. We are running the application on a box running W2k3 (no SP) and...
0
2181
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 debugger when I check the properties - 'domain', 'user name' and 'password' set in the ReportingService.Credentials; they are blank!!!
2
5866
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 connection was closed: An unexpected error occurred on a send. The only way I have been able to make consecutive web method invocations work is by...
1
8119
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 file and itself into the exe. You would probably want a tool for this bit which could be in the zip too. So the app isnt single exe when running but...
0
7467
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7401
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7656
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7756
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5326
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4944
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3450
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
703
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.