HelloServer.cs
上传用户:lxycoco
上传日期:2022-07-21
资源大小:38457k
文件大小:1k
源码类别:

C#编程

开发平台:

Others

  1. using System;
  2. using System.Runtime.Remoting;
  3. using System.Runtime.Remoting.Channels;
  4. using System.Runtime.Remoting.Channels.Tcp;
  5. using System.Runtime.Remoting.Channels.Http;
  6. using System.Collections;
  7. namespace Wrox.ProCSharp.Remoting
  8. {
  9. public class HelloServer
  10. {
  11. public static void ShowWellKnownServiceTypes()
  12. {
  13. WellKnownServiceTypeEntry[] entries =
  14. RemotingConfiguration.GetRegisteredWellKnownServiceTypes();
  15. foreach (WellKnownServiceTypeEntry entry in entries)
  16. {
  17. Console.WriteLine("Assembly: " + entry.AssemblyName);
  18. Console.WriteLine("Mode: " + entry.Mode);
  19. Console.WriteLine("URI: " + entry.ObjectUri);
  20. Console.WriteLine("Type: " + entry.TypeName);
  21. }
  22. }
  23. public static void ShowActivatedServiceTypes()
  24. {
  25. ActivatedServiceTypeEntry[] entries =
  26. RemotingConfiguration.GetRegisteredActivatedServiceTypes();
  27. foreach (ActivatedServiceTypeEntry entry in entries)
  28. {
  29. Console.WriteLine("Assembly: " + entry.AssemblyName);
  30. Console.WriteLine("Type: " + entry.TypeName);
  31. }
  32. }
  33. public static void Main(string[] args)
  34. {
  35. RemotingConfiguration.Configure("HelloServer.exe.config");
  36. Console.WriteLine("Application: " + RemotingConfiguration.ApplicationName);
  37. ShowActivatedServiceTypes();
  38. ShowWellKnownServiceTypes();
  39. System.Console.WriteLine("press return to exit");
  40. System.Console.ReadLine();
  41. }
  42. }
  43. }