You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.3 KiB

  1. using Microsoft.ServiceFabric.Services.Runtime;
  2. using System;
  3. using System.Diagnostics;
  4. using System.Threading;
  5. using System.Threading.Tasks;
  6. namespace ApiGw_Base
  7. {
  8. internal static class Program
  9. {
  10. /// <summary>
  11. /// This is the entry point of the service host process.
  12. /// </summary>
  13. private static void Main()
  14. {
  15. try
  16. {
  17. // The ServiceManifest.XML file defines one or more service type names.
  18. // Registering a service maps a service type name to a .NET type.
  19. // When Service Fabric creates an instance of this service type,
  20. // an instance of the class is created in this host process.
  21. ServiceRuntime.RegisterServiceAsync("ApiGw_BaseType",
  22. context => new ApiGw_Base(context)).GetAwaiter().GetResult();
  23. ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(ApiGw_Base).Name);
  24. // Prevents this host process from terminating so services keeps running.
  25. Thread.Sleep(Timeout.Infinite);
  26. }
  27. catch (Exception e)
  28. {
  29. ServiceEventSource.Current.ServiceHostInitializationFailed(e.ToString());
  30. throw;
  31. }
  32. }
  33. }
  34. }