mscorlib(4.0.0.0) API with additions
ChannelServices.cs
1 using System.Collections;
2 using System.Reflection;
8 using System.Security;
10 using System.Threading;
11 
13 {
15  [ComVisible(true)]
16  public sealed class ChannelServices
17  {
18  private static volatile object[] s_currentChannelData;
19 
20  private static object s_channelLock;
21 
22  private static volatile RegisteredChannelList s_registeredChannels;
23 
24  private static volatile IMessageSink xCtxChannel;
25 
26  [SecurityCritical]
27  private unsafe static volatile Perf_Contexts* perf_Contexts;
28 
29  private static bool unloadHandlerRegistered;
30 
31  internal static object[] CurrentChannelData
32  {
33  [SecurityCritical]
34  get
35  {
36  if (s_currentChannelData == null)
37  {
38  RefreshChannelData();
39  }
40  return s_currentChannelData;
41  }
42  }
43 
44  private static long remoteCalls
45  {
46  get
47  {
48  return Thread.GetDomain().RemotingData.ChannelServicesData.remoteCalls;
49  }
50  set
51  {
52  Thread.GetDomain().RemotingData.ChannelServicesData.remoteCalls = value;
53  }
54  }
55 
59  public static IChannel[] RegisteredChannels
60  {
61  [SecurityCritical]
62  get
63  {
64  RegisteredChannelList registeredChannelList = s_registeredChannels;
65  int count = registeredChannelList.Count;
66  if (count == 0)
67  {
68  return new IChannel[0];
69  }
70  int num = count - 1;
71  int num2 = 0;
72  IChannel[] array = new IChannel[num];
73  for (int i = 0; i < count; i++)
74  {
75  IChannel channel = registeredChannelList.GetChannel(i);
76  if (!(channel is CrossAppDomainChannel))
77  {
78  array[num2++] = channel;
79  }
80  }
81  return array;
82  }
83  }
84 
85  [SecuritySafeCritical]
86  static unsafe ChannelServices()
87  {
88  s_currentChannelData = null;
89  s_channelLock = new object();
90  s_registeredChannels = new RegisteredChannelList();
91  perf_Contexts = GetPrivateContextsPerfCounters();
92  unloadHandlerRegistered = false;
93  }
94 
95  private ChannelServices()
96  {
97  }
98 
99  [MethodImpl(MethodImplOptions.InternalCall)]
100  [SecurityCritical]
101  private unsafe static extern Perf_Contexts* GetPrivateContextsPerfCounters();
102 
111  [SecuritySafeCritical]
112  [SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.RemotingConfiguration)]
113  public static void RegisterChannel(IChannel chnl, bool ensureSecurity)
114  {
115  RegisterChannelInternal(chnl, ensureSecurity);
116  }
117 
123  [SecuritySafeCritical]
124  [Obsolete("Use System.Runtime.Remoting.ChannelServices.RegisterChannel(IChannel chnl, bool ensureSecurity) instead.", false)]
125  [SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.RemotingConfiguration)]
126  public static void RegisterChannel(IChannel chnl)
127  {
128  RegisterChannelInternal(chnl, ensureSecurity: false);
129  }
130 
131  [SecurityCritical]
132  internal unsafe static void RegisterChannelInternal(IChannel chnl, bool ensureSecurity)
133  {
134  if (chnl == null)
135  {
136  throw new ArgumentNullException("chnl");
137  }
138  bool lockTaken = false;
140  try
141  {
142  Monitor.Enter(s_channelLock, ref lockTaken);
143  string channelName = chnl.ChannelName;
144  RegisteredChannelList registeredChannelList = s_registeredChannels;
145  if (channelName != null && channelName.Length != 0 && -1 != registeredChannelList.FindChannelIndex(chnl.ChannelName))
146  {
147  throw new RemotingException(Environment.GetResourceString("Remoting_ChannelNameAlreadyRegistered", chnl.ChannelName));
148  }
149  if (ensureSecurity)
150  {
151  ISecurableChannel securableChannel = chnl as ISecurableChannel;
152  if (securableChannel == null)
153  {
154  throw new RemotingException(Environment.GetResourceString("Remoting_Channel_CannotBeSecured", chnl.ChannelName ?? chnl.ToString()));
155  }
156  securableChannel.IsSecured = ensureSecurity;
157  }
158  RegisteredChannel[] registeredChannels = registeredChannelList.RegisteredChannels;
159  RegisteredChannel[] array = null;
160  array = ((registeredChannels != null) ? new RegisteredChannel[registeredChannels.Length + 1] : new RegisteredChannel[1]);
161  if (!unloadHandlerRegistered && !(chnl is CrossAppDomainChannel))
162  {
163  AppDomain.CurrentDomain.DomainUnload += UnloadHandler;
164  unloadHandlerRegistered = true;
165  }
166  int channelPriority = chnl.ChannelPriority;
167  int i;
168  for (i = 0; i < registeredChannels.Length; i++)
169  {
170  RegisteredChannel registeredChannel = registeredChannels[i];
171  if (channelPriority > registeredChannel.Channel.ChannelPriority)
172  {
173  array[i] = new RegisteredChannel(chnl);
174  break;
175  }
176  array[i] = registeredChannel;
177  }
178  if (i == registeredChannels.Length)
179  {
180  array[registeredChannels.Length] = new RegisteredChannel(chnl);
181  }
182  else
183  {
184  for (; i < registeredChannels.Length; i++)
185  {
186  array[i + 1] = registeredChannels[i];
187  }
188  }
189  if (perf_Contexts != null)
190  {
191  perf_Contexts->cChannels++;
192  }
193  s_registeredChannels = new RegisteredChannelList(array);
194  RefreshChannelData();
195  }
196  finally
197  {
198  if (lockTaken)
199  {
200  Monitor.Exit(s_channelLock);
201  }
202  }
203  }
204 
210  [SecuritySafeCritical]
211  [SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.RemotingConfiguration)]
212  public unsafe static void UnregisterChannel(IChannel chnl)
213  {
214  bool lockTaken = false;
216  try
217  {
218  Monitor.Enter(s_channelLock, ref lockTaken);
219  if (chnl != null)
220  {
221  RegisteredChannelList registeredChannelList = s_registeredChannels;
222  int num = registeredChannelList.FindChannelIndex(chnl);
223  if (-1 == num)
224  {
225  throw new RemotingException(Environment.GetResourceString("Remoting_ChannelNotRegistered", chnl.ChannelName));
226  }
227  RegisteredChannel[] registeredChannels = registeredChannelList.RegisteredChannels;
228  RegisteredChannel[] array = null;
229  array = new RegisteredChannel[registeredChannels.Length - 1];
230  (chnl as IChannelReceiver)?.StopListening(null);
231  int num2 = 0;
232  int num3 = 0;
233  while (num3 < registeredChannels.Length)
234  {
235  if (num3 == num)
236  {
237  num3++;
238  }
239  else
240  {
241  array[num2] = registeredChannels[num3];
242  num2++;
243  num3++;
244  }
245  }
246  if (perf_Contexts != null)
247  {
248  perf_Contexts->cChannels--;
249  }
250  s_registeredChannels = new RegisteredChannelList(array);
251  }
252  RefreshChannelData();
253  }
254  finally
255  {
256  if (lockTaken)
257  {
258  Monitor.Exit(s_channelLock);
259  }
260  }
261  }
262 
263  [SecurityCritical]
264  internal static IMessageSink CreateMessageSink(string url, object data, out string objectURI)
265  {
266  IMessageSink messageSink = null;
267  objectURI = null;
268  RegisteredChannelList registeredChannelList = s_registeredChannels;
269  int count = registeredChannelList.Count;
270  for (int i = 0; i < count; i++)
271  {
272  if (registeredChannelList.IsSender(i))
273  {
274  IChannelSender channelSender = (IChannelSender)registeredChannelList.GetChannel(i);
275  messageSink = channelSender.CreateMessageSink(url, data, out objectURI);
276  if (messageSink != null)
277  {
278  break;
279  }
280  }
281  }
282  if (objectURI == null)
283  {
284  objectURI = url;
285  }
286  return messageSink;
287  }
288 
289  [SecurityCritical]
290  internal static IMessageSink CreateMessageSink(object data)
291  {
292  string objectURI;
293  return CreateMessageSink(null, data, out objectURI);
294  }
295 
300  [SecurityCritical]
301  public static IChannel GetChannel(string name)
302  {
303  RegisteredChannelList registeredChannelList = s_registeredChannels;
304  int num = registeredChannelList.FindChannelIndex(name);
305  if (0 <= num)
306  {
307  IChannel channel = registeredChannelList.GetChannel(num);
308  if (channel is CrossAppDomainChannel || channel is CrossContextChannel)
309  {
310  return null;
311  }
312  return channel;
313  }
314  return null;
315  }
316 
321  [SecurityCritical]
322  public static string[] GetUrlsForObject(MarshalByRefObject obj)
323  {
324  if (obj == null)
325  {
326  return null;
327  }
328  RegisteredChannelList registeredChannelList = s_registeredChannels;
329  int count = registeredChannelList.Count;
330  Hashtable hashtable = new Hashtable();
331  bool fServer;
332  Identity identity = MarshalByRefObject.GetIdentity(obj, out fServer);
333  if (identity != null)
334  {
335  string objURI = identity.ObjURI;
336  if (objURI != null)
337  {
338  for (int i = 0; i < count; i++)
339  {
340  if (registeredChannelList.IsReceiver(i))
341  {
342  try
343  {
344  string[] urlsForUri = ((IChannelReceiver)registeredChannelList.GetChannel(i)).GetUrlsForUri(objURI);
345  for (int j = 0; j < urlsForUri.Length; j++)
346  {
347  hashtable.Add(urlsForUri[j], urlsForUri[j]);
348  }
349  }
350  catch (NotSupportedException)
351  {
352  }
353  }
354  }
355  }
356  }
357  ICollection keys = hashtable.Keys;
358  string[] array = new string[keys.Count];
359  int num = 0;
360  foreach (string item in keys)
361  {
362  array[num++] = item;
363  }
364  return array;
365  }
366 
367  [SecurityCritical]
368  internal static IMessageSink GetChannelSinkForProxy(object obj)
369  {
370  IMessageSink result = null;
372  {
373  RealProxy realProxy = RemotingServices.GetRealProxy(obj);
374  RemotingProxy remotingProxy = realProxy as RemotingProxy;
375  if (remotingProxy != null)
376  {
377  Identity identityObject = remotingProxy.IdentityObject;
378  result = identityObject.ChannelSink;
379  }
380  }
381  return result;
382  }
383 
388  [SecuritySafeCritical]
389  [SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.RemotingConfiguration)]
390  public static IDictionary GetChannelSinkProperties(object obj)
391  {
392  IMessageSink channelSinkForProxy = GetChannelSinkForProxy(obj);
393  IClientChannelSink clientChannelSink = channelSinkForProxy as IClientChannelSink;
394  if (clientChannelSink != null)
395  {
396  ArrayList arrayList = new ArrayList();
397  do
398  {
399  IDictionary properties = clientChannelSink.Properties;
400  if (properties != null)
401  {
402  arrayList.Add(properties);
403  }
404  clientChannelSink = clientChannelSink.NextChannelSink;
405  }
406  while (clientChannelSink != null);
407  return new AggregateDictionary(arrayList);
408  }
409  IDictionary dictionary = channelSinkForProxy as IDictionary;
410  if (dictionary != null)
411  {
412  return dictionary;
413  }
414  return null;
415  }
416 
417  internal static IMessageSink GetCrossContextChannelSink()
418  {
419  if (xCtxChannel == null)
420  {
421  xCtxChannel = CrossContextChannel.MessageSink;
422  }
423  return xCtxChannel;
424  }
425 
426  [SecurityCritical]
427  internal unsafe static void IncrementRemoteCalls(long cCalls)
428  {
429  remoteCalls += cCalls;
430  if (perf_Contexts != null)
431  {
432  perf_Contexts->cRemoteCalls += (int)cCalls;
433  }
434  }
435 
436  [SecurityCritical]
437  internal static void IncrementRemoteCalls()
438  {
439  IncrementRemoteCalls(1L);
440  }
441 
442  [SecurityCritical]
443  internal static void RefreshChannelData()
444  {
445  bool lockTaken = false;
447  try
448  {
449  Monitor.Enter(s_channelLock, ref lockTaken);
450  s_currentChannelData = CollectChannelDataFromChannels();
451  }
452  finally
453  {
454  if (lockTaken)
455  {
456  Monitor.Exit(s_channelLock);
457  }
458  }
459  }
460 
461  [SecurityCritical]
462  private static object[] CollectChannelDataFromChannels()
463  {
464  RemotingServices.RegisterWellKnownChannels();
465  RegisteredChannelList registeredChannelList = s_registeredChannels;
466  int count = registeredChannelList.Count;
467  int receiverCount = registeredChannelList.ReceiverCount;
468  object[] array = new object[receiverCount];
469  int num = 0;
470  int i = 0;
471  int num2 = 0;
472  for (; i < count; i++)
473  {
474  IChannel channel = registeredChannelList.GetChannel(i);
475  if (channel == null)
476  {
477  throw new RemotingException(Environment.GetResourceString("Remoting_ChannelNotRegistered", ""));
478  }
479  if (registeredChannelList.IsReceiver(i))
480  {
481  if ((array[num2] = ((IChannelReceiver)channel).ChannelData) != null)
482  {
483  num++;
484  }
485  num2++;
486  }
487  }
488  if (num != receiverCount)
489  {
490  object[] array2 = new object[num];
491  int num3 = 0;
492  for (int j = 0; j < receiverCount; j++)
493  {
494  object obj = array[j];
495  if (obj != null)
496  {
497  array2[num3++] = obj;
498  }
499  }
500  array = array2;
501  }
502  return array;
503  }
504 
505  private static bool IsMethodReallyPublic(MethodInfo mi)
506  {
507  if (!mi.IsPublic || mi.IsStatic)
508  {
509  return false;
510  }
511  if (!mi.IsGenericMethod)
512  {
513  return true;
514  }
515  Type[] genericArguments = mi.GetGenericArguments();
516  foreach (Type type in genericArguments)
517  {
518  if (!type.IsVisible)
519  {
520  return false;
521  }
522  }
523  return true;
524  }
525 
533  [SecurityCritical]
534  public static ServerProcessing DispatchMessage(IServerChannelSinkStack sinkStack, IMessage msg, out IMessage replyMsg)
535  {
536  ServerProcessing serverProcessing = ServerProcessing.Complete;
537  replyMsg = null;
538  try
539  {
540  if (msg == null)
541  {
542  throw new ArgumentNullException("msg");
543  }
544  IncrementRemoteCalls();
545  ServerIdentity serverIdentity = CheckDisconnectedOrCreateWellKnownObject(msg);
546  if (serverIdentity.ServerType == typeof(AppDomain))
547  {
548  throw new RemotingException(Environment.GetResourceString("Remoting_AppDomainsCantBeCalledRemotely"));
549  }
550  IMethodCallMessage methodCallMessage = msg as IMethodCallMessage;
551  if (methodCallMessage != null)
552  {
553  MethodInfo methodInfo = (MethodInfo)methodCallMessage.MethodBase;
554  if (!IsMethodReallyPublic(methodInfo) && !RemotingServices.IsMethodAllowedRemotely(methodInfo))
555  {
556  throw new RemotingException(Environment.GetResourceString("Remoting_NonPublicOrStaticCantBeCalledRemotely"));
557  }
558  RemotingMethodCachedData reflectionCachedData = InternalRemotingServices.GetReflectionCachedData(methodInfo);
559  if (!RemotingServices.IsOneWay(methodInfo))
560  {
561  serverProcessing = ServerProcessing.Complete;
562  if (serverIdentity.ServerType.IsContextful)
563  {
564  replyMsg = GetCrossContextChannelSink().SyncProcessMessage(msg);
565  return serverProcessing;
566  }
567  object[] args = new object[2]
568  {
569  msg,
570  serverIdentity.ServerContext
571  };
572  replyMsg = (IMessage)CrossContextChannel.SyncProcessMessageCallback(args);
573  return serverProcessing;
574  }
575  serverProcessing = ServerProcessing.OneWay;
576  GetCrossContextChannelSink().AsyncProcessMessage(msg, null);
577  return serverProcessing;
578  }
579  if (!typeof(IMessageSink).IsAssignableFrom(serverIdentity.ServerType))
580  {
581  throw new RemotingException(Environment.GetResourceString("Remoting_AppDomainsCantBeCalledRemotely"));
582  }
583  serverProcessing = ServerProcessing.Complete;
584  replyMsg = GetCrossContextChannelSink().SyncProcessMessage(msg);
585  return serverProcessing;
586  }
587  catch (Exception e)
588  {
589  if (serverProcessing != ServerProcessing.OneWay)
590  {
591  try
592  {
593  object message2;
594  if (msg == null)
595  {
596  IMessage message = new ErrorMessage();
597  message2 = message;
598  }
599  else
600  {
601  message2 = msg;
602  }
603  IMethodCallMessage mcm = (IMethodCallMessage)message2;
604  replyMsg = new ReturnMessage(e, mcm);
605  if (msg == null)
606  {
607  return serverProcessing;
608  }
609  ((ReturnMessage)replyMsg).SetLogicalCallContext((LogicalCallContext)msg.Properties[Message.CallContextKey]);
610  return serverProcessing;
611  }
612  catch (Exception)
613  {
614  return serverProcessing;
615  }
616  }
617  return serverProcessing;
618  }
619  }
620 
626  [SecurityCritical]
628  {
629  IMessage message = null;
630  bool flag = false;
631  try
632  {
633  if (msg == null)
634  {
635  throw new ArgumentNullException("msg");
636  }
637  IncrementRemoteCalls();
638  if (!(msg is TransitionCall))
639  {
640  CheckDisconnectedOrCreateWellKnownObject(msg);
641  MethodBase methodBase = ((IMethodMessage)msg).MethodBase;
642  flag = RemotingServices.IsOneWay(methodBase);
643  }
644  IMessageSink crossContextChannelSink = GetCrossContextChannelSink();
645  if (flag)
646  {
647  crossContextChannelSink.AsyncProcessMessage(msg, null);
648  return message;
649  }
650  message = crossContextChannelSink.SyncProcessMessage(msg);
651  return message;
652  }
653  catch (Exception e)
654  {
655  if (!flag)
656  {
657  try
658  {
659  object message3;
660  if (msg == null)
661  {
662  IMessage message2 = new ErrorMessage();
663  message3 = message2;
664  }
665  else
666  {
667  message3 = msg;
668  }
669  IMethodCallMessage methodCallMessage = (IMethodCallMessage)message3;
670  message = new ReturnMessage(e, methodCallMessage);
671  if (msg == null)
672  {
673  return message;
674  }
675  ((ReturnMessage)message).SetLogicalCallContext(methodCallMessage.LogicalCallContext);
676  return message;
677  }
678  catch (Exception)
679  {
680  return message;
681  }
682  }
683  return message;
684  }
685  }
686 
693  [SecurityCritical]
695  {
696  IMessageCtrl result = null;
697  try
698  {
699  if (msg == null)
700  {
701  throw new ArgumentNullException("msg");
702  }
703  IncrementRemoteCalls();
704  if (!(msg is TransitionCall))
705  {
706  CheckDisconnectedOrCreateWellKnownObject(msg);
707  }
708  result = GetCrossContextChannelSink().AsyncProcessMessage(msg, replySink);
709  return result;
710  }
711  catch (Exception e)
712  {
713  if (replySink != null)
714  {
715  try
716  {
717  IMethodCallMessage methodCallMessage = (IMethodCallMessage)msg;
718  ReturnMessage returnMessage = new ReturnMessage(e, (IMethodCallMessage)msg);
719  if (msg != null)
720  {
721  returnMessage.SetLogicalCallContext(methodCallMessage.LogicalCallContext);
722  }
723  replySink.SyncProcessMessage(returnMessage);
724  return result;
725  }
726  catch (Exception)
727  {
728  return result;
729  }
730  }
731  return result;
732  }
733  }
734 
740  [SecurityCritical]
742  {
743  if (provider == null)
744  {
745  return new DispatchChannelSink();
746  }
747  IServerChannelSinkProvider serverChannelSinkProvider = provider;
748  while (serverChannelSinkProvider.Next != null)
749  {
750  serverChannelSinkProvider = serverChannelSinkProvider.Next;
751  }
752  serverChannelSinkProvider.Next = new DispatchChannelSinkProvider();
753  IServerChannelSink result = provider.CreateSink(channel);
754  serverChannelSinkProvider.Next = null;
755  return result;
756  }
757 
758  [SecurityCritical]
759  internal static ServerIdentity CheckDisconnectedOrCreateWellKnownObject(IMessage msg)
760  {
761  ServerIdentity serverIdentity = InternalSink.GetServerIdentity(msg);
762  if (serverIdentity == null || serverIdentity.IsRemoteDisconnected())
763  {
764  string uRI = InternalSink.GetURI(msg);
765  if (uRI != null)
766  {
767  ServerIdentity serverIdentity2 = RemotingConfigHandler.CreateWellKnownObject(uRI);
768  if (serverIdentity2 != null)
769  {
770  serverIdentity = serverIdentity2;
771  }
772  }
773  }
774  if (serverIdentity == null || serverIdentity.IsRemoteDisconnected())
775  {
776  string uRI2 = InternalSink.GetURI(msg);
777  throw new RemotingException(Environment.GetResourceString("Remoting_Disconnected", uRI2));
778  }
779  return serverIdentity;
780  }
781 
782  [SecurityCritical]
783  internal static void UnloadHandler(object sender, EventArgs e)
784  {
785  StopListeningOnAllChannels();
786  }
787 
788  [SecurityCritical]
789  private static void StopListeningOnAllChannels()
790  {
791  try
792  {
793  RegisteredChannelList registeredChannelList = s_registeredChannels;
794  int count = registeredChannelList.Count;
795  for (int i = 0; i < count; i++)
796  {
797  if (registeredChannelList.IsReceiver(i))
798  {
799  IChannelReceiver channelReceiver = (IChannelReceiver)registeredChannelList.GetChannel(i);
800  channelReceiver.StopListening(null);
801  }
802  }
803  }
804  catch (Exception)
805  {
806  }
807  }
808 
809  [SecurityCritical]
810  internal static void NotifyProfiler(IMessage msg, RemotingProfilerEvent profilerEvent)
811  {
812  switch (profilerEvent)
813  {
814  case RemotingProfilerEvent.ClientSend:
815  if (RemotingServices.CORProfilerTrackRemoting())
816  {
817  RemotingServices.CORProfilerRemotingClientSendingMessage(out Guid id2, fIsAsync: false);
818  if (RemotingServices.CORProfilerTrackRemotingCookie())
819  {
820  msg.Properties["CORProfilerCookie"] = id2;
821  }
822  }
823  break;
824  case RemotingProfilerEvent.ClientReceive:
825  {
826  if (!RemotingServices.CORProfilerTrackRemoting())
827  {
828  break;
829  }
830  Guid id = Guid.Empty;
831  if (RemotingServices.CORProfilerTrackRemotingCookie())
832  {
833  object obj = msg.Properties["CORProfilerCookie"];
834  if (obj != null)
835  {
836  id = (Guid)obj;
837  }
838  }
839  RemotingServices.CORProfilerRemotingClientReceivingReply(id, fIsAsync: false);
840  break;
841  }
842  }
843  }
844 
845  [SecurityCritical]
846  internal static string FindFirstHttpUrlForObject(string objectUri)
847  {
848  if (objectUri == null)
849  {
850  return null;
851  }
852  RegisteredChannelList registeredChannelList = s_registeredChannels;
853  int count = registeredChannelList.Count;
854  for (int i = 0; i < count; i++)
855  {
856  if (!registeredChannelList.IsReceiver(i))
857  {
858  continue;
859  }
860  IChannelReceiver channelReceiver = (IChannelReceiver)registeredChannelList.GetChannel(i);
861  string fullName = channelReceiver.GetType().FullName;
862  if (string.CompareOrdinal(fullName, "System.Runtime.Remoting.Channels.Http.HttpChannel") == 0 || string.CompareOrdinal(fullName, "System.Runtime.Remoting.Channels.Http.HttpServerChannel") == 0)
863  {
864  string[] urlsForUri = channelReceiver.GetUrlsForUri(objectUri);
865  if (urlsForUri != null && urlsForUri.Length != 0)
866  {
867  return urlsForUri[0];
868  }
869  }
870  }
871  return null;
872  }
873  }
874 }
static void RegisterChannel(IChannel chnl)
Registers a channel with the channel services. M:System.Runtime.Remoting.Channels....
static string [] GetUrlsForObject(MarshalByRefObject obj)
Returns an array of all the URLs that can be used to reach the specified object.
int ChannelPriority
Gets the priority of the channel.
Definition: IChannel.cs:14
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
Describes a set of security permissions applied to code. This class cannot be inherited.
virtual void Add(object key, object value)
Adds an element with the specified key and value into the T:System.Collections.Hashtable.
Definition: Hashtable.cs:916
IServerChannelSinkProvider Next
Gets or sets the next sink provider in the channel sink provider chain.
string ChannelName
Gets the name of the channel.
Definition: IChannel.cs:23
Holds a message returned in response to a method call on a remote object.
IDictionary Properties
Gets a dictionary through which properties on the sink can be accessed.
MethodBase MethodBase
Gets the T:System.Reflection.MethodBase of the called method.
Creates server channel sinks for the server channel through which remoting messages flow.
Discovers the attributes of a method and provides access to method metadata.
Definition: MethodInfo.cs:13
IMessage SyncProcessMessage(IMessage msg)
Synchronously processes the given message.
static IServerChannelSink CreateServerChannelSinkChain(IServerChannelSinkProvider provider, IChannelReceiver channel)
Creates a channel sink chain for the specified channel.
Defines the method call message interface.
static IChannel GetChannel(string name)
Returns a registered channel with the specified name.
Provides base functionality for proxies.
Definition: RealProxy.cs:22
Definition: __Canon.cs:3
Provides a mechanism that synchronizes access to objects.
Definition: Monitor.cs:13
Provides required functions and properties for the receiver channels.
IDictionary Properties
Gets an T:System.Collections.IDictionary that represents a collection of the message's properties.
Definition: IMessage.cs:15
Provides the stack functionality for a stack of server channel sinks.
Represents an application domain, which is an isolated environment where applications execute....
Definition: AppDomain.cs:33
bool IsStatic
Gets a value indicating whether the method is static.
Definition: MethodBase.cs:227
ServerProcessing
Indicates the status of the server message processing.
Provides methods used for security and transport sinks.
Provides a way to control asynchronous messages after they have dispatched using the M:System....
Definition: IMessageCtrl.cs:8
SecurityAction
Specifies the security actions that can be performed using declarative security.
static void Enter(object obj)
Acquires an exclusive lock on the specified object.
Provides information about, and means to manipulate, the current environment and platform....
Definition: Environment.cs:21
virtual bool IsGenericMethod
Gets a value indicating whether the method is generic.
Definition: MethodBase.cs:103
Represents a collection of key/value pairs that are organized based on the hash code of the key....
Definition: Hashtable.cs:17
virtual ICollection Keys
Gets an T:System.Collections.ICollection containing the keys in the T:System.Collections....
Definition: Hashtable.cs:617
LogicalCallContext LogicalCallContext
Gets the T:System.Runtime.Remoting.Messaging.LogicalCallContext for the current method call.
static IDictionary GetChannelSinkProperties(object obj)
Returns a T:System.Collections.IDictionary of properties for a given proxy.
IMessageSink CreateMessageSink(string url, object remoteChannelData, out string objectURI)
Returns a channel message sink that delivers messages to the specified URL or channel data object.
static void Exit(object obj)
Releases an exclusive lock on the specified object.
static void PrepareConstrainedRegions()
Designates a body of code as a constrained execution region (CER).
Provides static methods to aid with remoting channel registration, resolution, and URL discovery....
IMessageCtrl AsyncProcessMessage(IMessage msg, IMessageSink replySink)
Asynchronously processes the given message.
Defines utility methods for use by the .NET Framework remoting infrastructure.
static ServerProcessing DispatchMessage(IServerChannelSinkStack sinkStack, IMessage msg, out IMessage replyMsg)
Dispatches incoming remote calls.
Provides information about methods and constructors.
Definition: MethodBase.cs:19
bool IsPublic
Gets a value indicating whether this is a public method.
Definition: MethodBase.cs:149
IClientChannelSink NextChannelSink
Gets the next client channel sink in the client sink chain.
MethodImplOptions
Defines the details of how a method is implemented.
static AppDomain GetDomain()
Returns the current domain in which the current thread is running.
Definition: Thread.cs:1096
Provides a set of properties that are carried with the execution code path during remote method calls...
Defines the method message interface.
override Type [] GetGenericArguments()
Returns an array of T:System.Type objects that represent the type arguments of a generic method or th...
Definition: MethodInfo.cs:109
virtual int Add(object value)
Adds an object to the end of the T:System.Collections.ArrayList.
Definition: ArrayList.cs:2381
static bool IsTransparentProxy(object proxy)
Returns a Boolean value that indicates whether the given object is a transparent proxy or a real obje...
Contains communication data sent between cooperating message sinks.
Definition: IMessage.cs:9
static void RegisterChannel(IChannel chnl, bool ensureSecurity)
Registers a channel with the channel services.
static unsafe void UnregisterChannel(IChannel chnl)
Unregisters a particular channel from the registered channels list.
static RealProxy GetRealProxy(object proxy)
Returns the real proxy backing the specified transparent proxy.
static IMessageCtrl AsyncDispatchMessage(IMessage msg, IMessageSink replySink)
Asynchronously dispatches the given message to the server-side chain(s) based on the URI embedded in ...
static bool IsOneWay(MethodBase method)
Returns a Boolean value that indicates whether the client that called the method specified in the giv...
Provides conduits for messages that cross remoting boundaries.
Definition: IChannel.cs:8
IServerChannelSink CreateSink(IChannelReceiver channel)
Creates a sink chain.
Represents errors that occur during application execution.To browse the .NET Framework source code fo...
Definition: Exception.cs:22
Defines the interface for a message sink.
Definition: IMessageSink.cs:8
Provides required functions and properties for client channel sinks.
int Count
Gets the number of elements contained in the T:System.Collections.ICollection.
Definition: ICollection.cs:14
static IMessage SyncDispatchMessage(IMessage msg)
Synchronously dispatches the incoming message to the server-side chain(s) based on the URI embedded i...
The exception that is thrown when an invoked method is not supported, or when there is an attempt to ...
Defines size, enumerators, and synchronization methods for all nongeneric collections.
Definition: ICollection.cs:8
SecurityPermissionFlag
Specifies access flags for the security permission object.
Provides several methods for using and publishing remoted objects and proxies. This class cannot be i...
Represents a nongeneric collection of key/value pairs.
Definition: IDictionary.cs:8
Provides required functions and properties for the sender channels.
static IChannel [] RegisteredChannels
Gets a list of currently registered channels.
The exception that is thrown when something has gone wrong during remoting.
Provides a set of static methods and properties that provide support for compilers....
Implements the T:System.Collections.IList interface using an array whose size is dynamically increase...
Definition: ArrayList.cs:14
Enables access to objects across application domain boundaries in applications that support remoting.
Creates and controls a thread, sets its priority, and gets its status.
Definition: Thread.cs:18