When throwing any exception from Remoting'ly created object
on the client side we have RemotingException instead having something like this:
Server encountered an internal error. For more information, turn off customErrors in the server's .config file.
instead of the real exception.
Be aware - it happens only when calling object really remotely, not by remoting on the same computer.
The solution should be to add following lines to your *.config file (either app.config copyied then to appname.exe.config or web.config):
However it does not help!
The reason is in strange fact that Remoting does not load the config settings by default. Can't imagine why...
To workaround this, have something like this in startup method of your application:
string configPath =
System.Reflection.Assembly.GetExecutingAssembly().Location + ".config";
System.Runtime.Remoting.RemotingConfiguration.Configure(configPath);
The goal is to force Remoting to final load the config from proper file.
I saw an idea to use a null instead of file name, but this did no work for me.
Enjoy!
You can use code like this
bool b = System.Runtime.Remoting.RemotingConfiguration.CustomErrorsEnabled(false);
to check this setting.
Thanks Chris Taylor for great info from here:
http://dotnetjunkies.com/WebLog/chris.taylor/articles/5566.aspx
No comments:
Post a Comment