remoting timeout
- From: Arno Richard <ArnoRichard@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 8 May 2006 07:57:01 -0700
All,
I have remote objects hosted in IIS, created in my client application (a web
application) using Activator.GetObject().
For most of my calls, the default timeout is fine as they should return
quickly. However, I need to trigger from the client some long-running calls,
that I know will be well above the default timeout, which is expected
behaviour.
Is it possible to change the timeout for an instance of a proxy to my remote
service?
I have tried the following without success:
[1] setting the timeout property in the channel:
....
object myObject = Activator.GetObject(myService.ObjectType,
myService.ObjectUrl);
IDictionary channelProperties =
ChannelServices.GetChannelSinkProperties(myObject);
channelProperties["timeout"] = -1;
....
[2] returning NULL as the LifeTimeService object in my service:
public class MyService : MarshalByRefObject {
public MyService() { }
public override object InitializeLifetimeService() {
return(null);
}
....
[3] changing the InitialLeaseTime to a ridiculous amount:
public class MyService : MarshalByRefObject {
public MyService() { }
public override object InitializeLifetimeService() {
ILease myLease = (ILease)base.InitializeLifetimeService();
if (myLease != null && myLease.CurrentState == LeaseState.Initial) {
myLease.InitialLeaseTime = TimeSpan.FromMinutes(60);
myLease.RenewOnCallTime = TimeSpan.FromMinutes(60);
myLease.SponsorshipTimeout = TimeSpan.FromMinutes(5);
}
return(myLease);
}
....
[4] registering a sponsor for the activated object that has a long renewal:
....
MarshalByRefObject myObject = Activator.GetObject(myService.ObjectType,
myService.ObjectUrl);
ILease myLease = (ILease)RemotingServices.GetLifetimeService(myObject);
LongRunningSponsor mySponsor = new LongRunningSponsor();
myLease.Register(mySponsor);
....
public class LongRunningSponsor: MarshalByRefObject, ISponsor {
public LongRunningSponsor() { }
public TimeSpan Renewal(ILease lease) {
TimeSpan ts = TimeSpan.FromMinutes(60);
return(ts);
}
}
Whatever I do, my service is created, the service call is done, but then
fails mid-way because the thread is aborted as the request is timing out.
Am I missing something, or is that possible at all?
Any help will be much appreciated.
Regards,
Arnaud Richard
.
- Prev by Date: hooks to ORPC?
- Next by Date: Socket problem with Singleton, that creates CAO's
- Previous by thread: hooks to ORPC?
- Next by thread: Socket problem with Singleton, that creates CAO's
- Index(es):
Relevant Pages
|
Loading