.NET 远程应用程序的调试、性能监控与对象生命周期管理
1. 远程异常处理
在编写代码时,我们不能总是假设一切都会顺利进行,所有资源都可用。在 .NET 远程应用程序中,当遇到错误时, RemotingException 类会被实例化以表示该错误。通常,在 .NET 远程客户端应用程序中,可能抛出异常的代码是尝试连接到服务器的代码以及调用远程对象方法的代码。
以下是处理远程异常的代码示例:
VB 代码
Imports System.Runtime
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Tcp
Imports MSLearning.Chapter6.PatientClasses
Namespace MSLearning.Chapter6.ActivatorGetObject
Module GetObjectModule
Sub Main()
Try
' Create an instance of the Patient class.
Dim newPatient As Patient = _
CType(Activator.GetObject(GetType(Patient), _
超级会员免费看
订阅专栏 解锁全文
16

被折叠的 条评论
为什么被折叠?



