remoting timeout



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
.



Relevant Pages

  • Re: web serivce: client side timeout?
    ... client side but only from the server side. ... System.Net.Sockets.SocketException: A connection attempt failed ... asyncResult, Int32 timeout, Exception& exception) ... John Saunders | MVP - Windows Server System - Connected System ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: detecting the (brute) disconnection of a client
    ... crashed, and if an exception occurs, then the client is deconnected. ... You can either use the timeout itself as an indication of connection failure, or you can attempt to send data after the timeout. ... The server has no way to know if the connection has failed due to a client-side crash, or simply due to a temporary problem with the network. ... IMHO, it would be better to simply let the server continue to assume that the connection is valid unless there is some explicit, non-arbitrary verification that it's not. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: web serivce: client side timeout?
    ... I have a windows forms application that makes calls to a web service. ... client side but only from the server side. ... System.Net.Sockets.SocketException: A connection attempt failed ... asyncResult, Int32 timeout, Exception& exception) ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: web serivce: client side timeout?
    ... client side but only from the server side. ... System.Net.Sockets.SocketException: A connection attempt failed ... asyncResult, Int32 timeout, Exception& exception) ... John Saunders | MVP - Windows Server System - Connected System ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: web serivce: client side timeout?
    ... client side but only from the server side. ... System.Net.Sockets.SocketException: A connection attempt failed ... asyncResult, Int32 timeout, Exception& exception) ... John Saunders | MVP - Windows Server System - Connected System ...
    (microsoft.public.dotnet.framework.webservices)

Loading