Detect if FaultException is from remote source

31 views Asked by At

I have a distributed server application.

A client connects to a slave server and calls a method which is propagated to the master server. The master server throws a FaultException<CustomFault>().

The slave server propagates that FaultException<CustomFault>() to the connected client then. But the client receives the non-generic FaultException instead.

If I catch and rethrow it (create a new instance of FaultException<CustomFault>) on slave server it works as expected:

    protected void Rethrow(Action action)
    {
        try
        {
            action();
        }
        catch (FaultException<CustomFault> kEx)
        {
            throw new FaultException<CustomFault>(kEx.Detail);
        }
    }

Therefore I assume that all my interfaces are decorated correctly. I can only assume that microsoft considers throwing FaultExceptions via several servers is considered a security issue...

How can I identify that the FaultException was thrown from a different server? Checking the call stack for:

Server stack trace: 
  at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
  at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
  at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
  at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

seems wrong to me. Any better ideas?

1

There are 1 answers

0
toATwork On BEST ANSWER

If anybody else has the same problem:

If the FaultException is from a remote source - the Action property inidicates the service!