/// <summary> /// This is the entry point of the service host process. /// </summary> private static void Main() { try { IServiceFabricConfigurationService serviceFabricConfigurationService = new ServiceFabricConfigurationService(); // License Aspose.Cells SoftwareLicenceSection softwareLicenceSection = serviceFabricConfigurationService.GetConfigSectionAs <SoftwareLicenceSection>(nameof(SoftwareLicenceSection)); if (!string.IsNullOrEmpty(softwareLicenceSection.AsposeLicence)) { using (MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(softwareLicenceSection.AsposeLicence.Replace("<", "<").Replace(">", ">")))) { new Aspose.Cells.License().SetLicense(ms); } } // Setup Autofac ContainerBuilder builder = ESFA.DC.DataMatch.ReportService.Core.DIComposition.BuildNewContainer(); ConfigurationRootModel configurationRoot = DICompositionServiceFabric.BuildContainer(builder, serviceFabricConfigurationService); ESFA.DC.DataMatch.ReportService.Core.DIComposition.BuildContainer(builder, configurationRoot); ESFA.DC.DataMatch.ReportService.Core.DIComposition.BuildStorageContainerAzure(builder, configurationRoot.azureBlobStorageOptions); // Register the Autofac magic for Service Fabric support. builder.RegisterServiceFabricSupport(); // Register the stateless service. builder.RegisterStatelessService <ServiceFabric.Common.Stateless>("ESFA.DC.DataMatch.ReportService.StatelessType"); using (var container = builder.Build()) { ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(ServiceFabric.Common.Stateless).Name); // Prevents this host process from terminating so services keep running. Thread.Sleep(Timeout.Infinite); } } catch (Exception e) { ServiceEventSource.Current.ServiceHostInitializationFailed(e + Environment.NewLine + (e.InnerException?.ToString() ?? "No inner exception")); throw; } }
/// <summary> /// This is the entry point of the service host process. /// </summary> private static void Main() { try { IConfigurationHelper configHelper = new ConfigurationHelper(); // License Aspose.Cells SoftwareLicenceSection softwareLicenceSection = configHelper.GetSectionValues <SoftwareLicenceSection>(nameof(SoftwareLicenceSection)); if (!string.IsNullOrEmpty(softwareLicenceSection.AsposeLicence)) { using (MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(softwareLicenceSection.AsposeLicence.Replace("<", "<").Replace(">", ">")))) { new Aspose.Cells.License().SetLicense(ms); } } // The ServiceManifest.XML file defines one or more service type names. // Registering a service maps a service type name to a .NET type. // When Service Fabric creates an instance of this service type, // an instance of the class is created in this host process. var builder = DIComposition.BuildContainer(); builder.RegisterServiceFabricSupport(); builder.RegisterStatelessService <Stateless>("ESFA.DC.NCS.StatelessType"); using (var container = builder.Build()) { ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(Stateless).Name); // Prevents this host process from terminating so services keep running. Thread.Sleep(Timeout.Infinite); } } catch (Exception e) { ServiceEventSource.Current.ServiceHostInitializationFailed(e.ToString()); throw; } }
/// <summary> /// This is the entry point of the service host process. /// </summary> private static void Main() { try { IServiceFabricConfigurationService serviceFabricConfigurationService = new ServiceFabricConfigurationService(); // License Aspose.Cells SoftwareLicenceSection softwareLicenceSection = serviceFabricConfigurationService.GetConfigSectionAs <SoftwareLicenceSection>(nameof(SoftwareLicenceSection)); // Setup Autofac ContainerBuilder builder = DIComposition.BuildContainer(); // Register the Autofac magic for Service Fabric support. builder.RegisterServiceFabricSupport(); // Register the stateless service. builder.RegisterStatelessService <ServiceFabric.Common.Stateless>("ESFA.DC.Operations.Reports.StatelessType"); using (var container = builder.Build()) { var excelFileService = container.Resolve <IExcelFileService>(); if (!string.IsNullOrEmpty(softwareLicenceSection.AsposeLicence)) { using (MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(softwareLicenceSection.AsposeLicence.Replace("<", "<").Replace(">", ">")))) { excelFileService.ApplyLicense(ms); } } ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(ServiceFabric.Common.Stateless).Name); // Prevents this host process from terminating so services keep running. Thread.Sleep(Timeout.Infinite); } } catch (Exception e) { ServiceEventSource.Current.ServiceHostInitializationFailed(e.ToString()); throw; } }
/// <summary> /// This is the entry point of the service host process. /// </summary> public static void Main() { try { IConfigurationHelper configHelper = new ConfigurationHelper(); // License Aspose.Cells SoftwareLicenceSection softwareLicenceSection = configHelper.GetSectionValues <SoftwareLicenceSection>(nameof(SoftwareLicenceSection)); if (!string.IsNullOrEmpty(softwareLicenceSection.AsposeLicence)) { using (MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(softwareLicenceSection.AsposeLicence.Replace("<", "<").Replace(">", ">")))) { new Aspose.Cells.License().SetLicense(ms); } } // Setup Autofac ContainerBuilder builder = DIComposition.BuildContainer(configHelper); // Register the Autofac magic for Service Fabric support. builder.RegisterServiceFabricSupport(); // Register the stateless service. builder.RegisterStatelessService <Stateless>("ESFA.DC.ILR1819.ReportService.StatelessType"); using (var container = builder.Build()) { ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(Stateless).Name); // Prevents this host process from terminating so services keep running. Thread.Sleep(Timeout.Infinite); } } catch (Exception e) { ServiceEventSource.Current.ServiceHostInitializationFailed(e + Environment.NewLine + (e.InnerException?.ToString() ?? "No inner exception")); throw; } }