private static void RegisterObjectWellKnown(MarshalByRefObject obj, string servicename) { ObjRef objrefWellKnown = RemotingServices.Marshal(obj, servicename); log.Debug("RegisterService: " + obj.ToString()+" as "+servicename); }
private static void UnregisterObjectWellKnown(MarshalByRefObject obj) { if (obj!=null) log.Debug("UnregisterService: " + obj.ToString()+" "+RemotingServices.Disconnect(obj).ToString()); }
/// <summary> /// Publishes the well known service instance. /// </summary> /// <param name="notifyName">Name of the notify.</param> /// <param name="interfaceType">Type of the interface.</param> /// <param name="instance">The instance.</param> /// <param name="mode">The mode.</param> public void PublishWellKnownServiceInstance(string notifyName, Type interfaceType, MarshalByRefObject instance, WellKnownObjectMode mode) { WriteLog("Instance URL --> " + BuildUrl(notifyName), LogType.Information); RemotingConfiguration.RegisterWellKnownServiceType(interfaceType, BuildUrl(notifyName), mode); ObjRef objRef = RemotingServices.Marshal(instance, notifyName); if (instance == null) WriteLog("(" + BuildUrl(notifyName) + ") start listening at port: " + serverPort, LogType.Information); else WriteLog("(" + instance.ToString() + ") start listening at port: " + serverPort, LogType.Information); }