我正在開發.Net Remoting項目。我想監視遠程調用和返回值或可能的異常。 我實現了IMessageSink確定回覆的消息是否包含.Net Remoting通道中的異常IMessageSink
Public Function SyncProcessMessage(ByVal msg As System.Runtime.Remoting.Messaging.IMessage) As System.Runtime.Remoting.Messaging.IMessage Implements System.Runtime.Remoting.Messaging.IMessageSink.SyncProcessMessage
Dim replyMsg As IMessage = _NextMessageSink.SyncProcessMessage(msg)
if {ReplyMsg Contains Exception of type a} then
do something
else if {ReplyMsg Contains Exception of type b} then
do someshing else
End If
Return replyMsg
End Function
服務時拋出異常ReplyMsg只包含LogicalCallContext。 我怎麼找到異常類型?
順便說一句,我希望你知道Remoting已被棄用,贊成WCF? –
是的,但是這是一個龐大的系統,並在幾年前實施,我們現在無法移動到WCF,我只是在改變ChannelSinks。 – user1929392