Click here to Skip to main content
15,891,423 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
XML
/// <summary>
 /// This method is used to get the remoting instance(transparent proxy).
 /// </summary>
 /// <typeparam name="T">Server Type.</typeparam>
 /// <param name="serverConfig">Instance of Config.</param>
 /// <returns>JobInterface</returns>
 public static T GetInterface<T>(ServerConfig serverConfig)
 {
     T instance = default(T);//EHN_DEC_09
     if (serverConfig != null)
     {
          try
          {
               string url = String.Format("tcp://{0}:{1}/{2}", serverConfig.IPAddress,              serverConfig.Port, serverConfig.URI);
               Log(LogMessageType.Debug, " GetInterface", "GetObject started");
               instance = (T)Activator.GetObject(typeof(T), url);
               Log(LogMessageType.Debug, " GetInterface", "GetObject completed");
               MarshalByRefObject obj = instance as MarshalByRefObject;
               Log(LogMessageType.Debug, " GetInterface", "GetLifetimeService started");
               Object lifeTimeObject = obj.GetLifetimeService();//EHN_DEC_09
               Log(LogMessageType.Debug, " GetInterface", "GetLifetimeService completed");



            }
            //EHN_DEC_09
            //.GetLifeTimeService call is added to check whether the remoting proxy
            //object is valid or not. If the call throws SocketException means the proxy is
            //pointed to invalid remoting objects.
            catch (SocketException ex)
            {
                Log(LogMessageType.Error, " GetInterfaceByServerConfig", ex.ToString());
                //EHN_DEC_09
                instance = default(T);
            }
            catch (Exception ex)
            {
                Log(LogMessageType.Error, "GetInterfaceByServerConfig", ex.ToString());
            }
        }
        return instance;
    }
in the above code GetLifetimeService takes 1 sec to return for the first time call in vs2010 build but in 2012 it is reduced. Can anyone please help me to say why this occurs and way

to reduce it?
Posted
Updated 19-May-14 18:30pm
v4
Comments
Sergey Alexandrovich Kryukov 19-May-14 11:28am    
Reduced? Congratulations!
But it all has nothing to do with the version of Visual Studio, which is only the IDE. It does not even build anything.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900