• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 925
  • Last Modified:

VB.Net Remoting Timeout Issue

Does anybody know if there is a way to modify the timeout associated with remoting?  

We have a vb.net 3.5 console application which uses remoting for executing application code. Below is the method and app.config key used to remote.  

It seems that the process on the client machine times out after around 20 minutes.  We have a job that runs a large SQL job which can take 30-45 minutes and right now we are forced to do it in 2 different calls which is very messy.  Anyway to prevent the client to timeout when using remoting?

Thanks ahead of time.
Private Sub ConfigureRemoting()                   RemotingConfiguration.RegisterWellKnownClientType(GetType(BusinessRules.CreditSystem), System.Configuration.ConfigurationManager.AppSettings("Application.Credit.Server"))
        End Sub


<add key="Application.Credit.Server" value="http://localhost/applicationserver/creditsystem.rem" />

Open in new window

0
kruegerste
Asked:
kruegerste
  • 3
  • 3
2 Solutions
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
In your class that Inherits MarshalByRefObject, override the InitializeLifetimeService() function and return Nothing:
Public Class MyRemotingObject
    Inherits MarshalByRefObject

    Public Overrides Function InitializeLifetimeService() As Object
        Return Nothing ' <-- Keep our instance from being garbage collected
    End Function

End Class

Open in new window


This will give your object infinite life and it will not be garbage collected...
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
See Managing the Lifetime of Remote .NET Objects with Leasing and Sponsorship:
http://msdn.microsoft.com/en-us/magazine/cc300474.aspx

In the Leasing Specifics section:

    "Fortunately, infinite lease time is supported. When you design a singleton object, override InitializeLifetimeService and return a null object as the new lease, indicating that this lease never expires"
0
 
kruegersteAuthor Commented:
THanks for the suggestion.  Is there anyway though to set the actual timeout or just extend it?  

The main issue is that the public class that inherits MarshalByRefObject contains methods for all sorts of different applications. It is very large to say the least. Is this override going to create issues with garbage collecting on these other methods?  What is the impact of making this change?  
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
kruegersteAuthor Commented:
Oh, and I didn't see your 2nd post until after my follow-up, but I wanted to add that i don't think we are using a singleton object per-say. I'm concerned this technique might create other issues with our application.
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
The MSDN article I linked explains the leasing model if you want to specify a time limit and then extend that lease each time it expires.
0
 
kruegersteAuthor Commented:
abandoned
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now