all groups > dotnet remoting > august 2005 >
You're in the

dotnet remoting

group:

Remoting Custom Exception problem !!!


Remoting Custom Exception problem !!! Shibu
8/30/2005 10:42:49 PM
dotnet remoting:
Hi,

I have One Client (Machine 1), Remoting Server-1 (Machine 2), Remoting
Server-2 (Machine 3)

Client calls Remoting Server-1 and Remote Server-1 calls Remoting Server-2.

Requirement is that, when a custom exception is thrown from the Remoting
Server-2, it should reach Client application at
Machine 1.

Custom exception classes are defined in a common shared dll which is present
at Client and Both the Remoting Servers.
At server configuration file, custom errors is set to off
Custom exception class is as shown below.

using System;
using System.Runtime.Serialization;
namespace TMSC.CIS.MyException
{
[Serializable]
public class MyCustomException : : ApplicationException
{
public MyCustomException()
{
}
public MyCustomException(string message): base(message)
{
}
public MyCustomException(string message, Exception inner):
base(message, inner)
{
}
public MyCustomException(SerializationInfo info, StreamingContext
context) : base(info, context)
{
}
}
}


Exception thrown from the Remoting Object Class at Remoting Server-2
successfully reached the client.

PROBLEM
But if an exception is thrown from other classes
at Remote Server-2, it says file not found exception at Remoting Server-1.

When I copied the Remote Server-2 dll to the Remote Server-1 location, it
worked fine. (Not the right solution)
What could be the problem.

Any suggestions appriciated.
Shibu

Re: Remoting Custom Exception problem !!! Allen Anderson
8/31/2005 10:57:30 AM
are the exceptions that are being thrown from the other classes defined in the share.dll?

If so then the problem may be related to the class definition that the exception is trying to send down on it's from member. To get around this you might try catch at the shared class level then rethrow the exception from that class. Otherwise your
going to have to make that class definition available to the client side to some degree.

-Allen
http://www.glacialcomponents.com
http://allenanderson.blogspot.com

[quoted text, click to view]
Re: Remoting Custom Exception problem !!! Shibu
9/3/2005 12:00:00 AM
Hi Allen,

Custom exception classes are defined in the share.dll (shared assembly)
I per your previous suggestion, I tried to throw exception from the
share.dll . I see another thing that the exceptions which are not caught
inside a try{} catch{} block is reaching chient as expected. But once it is
caught in the try{} catch{} block of
Remoting Server-2, and thrown from there with innerexception, exception is
not reaching client.

Any suggestions?? I am realy confused now that, whether custom exception is
possible in my remoting app.
Shibu


[quoted text, click to view]
exception is trying to send down on it's from member. To get around this
you might try catch at the shared class level then rethrow the exception
from that class. Otherwise your
[quoted text, click to view]

Re: Remoting Custom Exception problem !!! Allen Anderson
9/6/2005 10:07:29 PM
I think maybe I didn't explain that as well as I should have. If your
exception contains any information about the class that threw it, then
whatever catches it (ie if it's caught on the client side) will have
to have that information available.

therefore, catch the exception in the remoted class itself that is on
the server side and rethrow a generic exception that is serializable
and contains no extra data inside it. When you get that to work, add
the oither data you need to send over till something breaks.

If you need I can write a small example program that demonstrates
this.

-Allen
http://www.glacialcomponents.com
http://allenanderson.blogspot.com


[quoted text, click to view]
Re: Remoting Custom Exception problem !!! ShiTvm
9/30/2005 11:32:45 PM
Hi Allen,
Can you please send me the sample code..

Rgds
Shibu

[quoted text, click to view]

AddThis Social Bookmark Button