Bubbling Exceptions thrown in a Remoted Object

Z

Z D

Hello,

I have a remoted object which throws an exception if something goes bad. eg:
throw new Exception("Something went wrong.");

When I test the assembly locally on my machine (without remoting), things
work fine.

However, once I remote the object, whenever an exception is thrown, I ALWAYS
get the same generic exception in my try/catch block:

{System.Runtime.Remoting.RemotingException}
The message is: {Server encountered an internal error. For more
information, turn on customErrors in the server's .config file"}



Any usggestions? I've tried setting CustomErrors=on/remoteOnly/off in
web.config but it doesn't change anything.

Note: I'm using HTTP/binary remoting via IIS.


Any suggestions/assistance would be greatly appreciated. Thanks!

-ZD
 
N

Nicholas Paldino [.NET/C# MVP]

Z D,

Have you checked the InnerException property? Because the exception
happens on another machine (and something could go wrong with the remoting
plumbing which would throw an exception) any exceptions that occur on the
server side are wrapped in a RemotingException, to distinguish the
exceptions that are thrown as a result of plumbing, instead of your code.

Hope this helps.
 
R

Robert Hurlbut

Z D,

The correct setting is:

<system.runtime.remoting>
<customErrors mode="off"/>
...
</system.runtime.remoting>

in the web.config on the remote/server side.

Also, are you throwing any custom exceptions? If so, you need to make sure
the custom exception is also defined and referenced on both sides of the
wire (client and server) in order for the exception to serialize and
deserialize properly.

Robert Hurlbut
http://weblogs.asp.net/rhurlbut
http://www.securedevelop.net
 
G

Guest

I have tried this. I have a binary formatter using a tcp channel. The server
is supported by a service so the configuration is
ApplicationServer.exe.config. I have added the lines below but I still get
the message urging me to change the configuration to show more detailed error
information. I would like to see all of the exception information. I am
checking for InnerException and it seems to be null.

Kevin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top