0
我有一個分佈式服務器應用程序。檢測FaultException是否來自遠程源
客戶端連接到從服務器並調用傳播到主服務器的方法。主服務器會拋出一個FaultException<CustomFault>()
。
然後,從服務器將該FaultException<CustomFault>()
傳播到連接的客戶端。但客戶端會收到非通用的FaultException
。
如果我趕上並重新拋出它(創建FaultException<CustomFault>
一個新的實例),它按預期工作從服務器上:
protected void Rethrow(Action action)
{
try
{
action();
}
catch (FaultException<CustomFault> kEx)
{
throw new FaultException<CustomFault>(kEx.Detail);
}
}
因此,我認爲我的所有接口都正確裝飾。我只能假設微軟認爲通過多個服務器拋出FaultExceptions被認爲是一個安全問題...
如何識別FaultException是從其他服務器拋出的?檢查呼叫堆棧:
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)
對我來說似乎不對。任何更好的想法?