我在客户端定义生存期租约对象时,经过调试发现定义的lease总是为Nothing,造成接下来lease.Register(sponsor)出错,请问这是怎么回事
客户端代码如下:
RemotingConfiguration.Configure("Client.exe.config", False)
Dim obj As RemoteType.RemoteType.ClientActivatedType = New _RemoteType.RemoteType.ClientActivatedType()
Dim lease As ILease = CType(obj.GetLifetimeService(), ILease)'就是这里有问题,lease总是为Nothing
Dim sponsor As MyClientSponsor = New MyClientSponsor()
If Not lease Is Nothing Then
lease.Register(sponsor)
End If
客户端配置文件如下:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref="tcp" port="0">
<clientProviders>
<formatter ref="binary"/>
</clientProviders>
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full"/>
</serverProviders>
</channel>
</channels>
<client url="tcp://localhost:1234">
<activated type="RemoteType.ClientActivatedType, RemoteType" />
</client>
</application>
</system.runtime.remoting>
</configuration>
请高手指点,已经做了一天了,还是没搞定,急!!!