Пример #1
0
        public void HostApplication(ApplicationEventSource log)
        {
            try
            {
                // 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.

                //using (DiagnosticPipeline diagnosticsPipeline = ServiceFabricDiagnosticPipelineFactory.CreatePipeline("Service-DiagnosticsPipeline"))
                {
                    ServiceRuntime.RegisterServiceAsync("BlackCoffeeTalkType",
                                                        context => new BlackCoffeeTalk.Hosting.Asf.Service(context)).GetAwaiter().GetResult();

                    ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(BlackCoffeeTalk.Hosting.Asf.Service).Name);

                    Thread.Sleep(Timeout.Infinite);
                }
                Task.Delay(-1).Wait();
            }
            catch (Exception e)
            {
                ServiceEventSource.Current.ServiceHostInitializationFailed(e.ToString());
                throw;
            }
        }
        public void HostApplication(ApplicationEventSource log)
        {
            var eventListener = new ConsoleEventListener();

            eventListener.EnableEvents(log, EventLevel.LogAlways, (EventKeywords)long.MaxValue);

            var config = new ApplicationConfiguration
            {
                EventSource  = log,
                MainDatabase = this.ConnectionString,
                HostAddress  = this.HostAddress,
            };

            using (WebApp.Start(this.HostAddress, app => Application.Bootstrap(app, config)))
            {
                log.Message($"Local service started at {this.HostAddress}");
                Task.Delay(-1).Wait();
            }
        }
 public LocalHosting(ApplicationEventSource log, IConfigurationRoot configuration)
 {
     this.Configuration = configuration;
     HostApplication(log);
 }
Пример #4
0
 public ExceptionHandler(ApplicationEventSource eventSource)
 {
     _eventSource = eventSource;
 }
Пример #5
0
 public ServiceFactoryHosting(ApplicationEventSource log)
 {
     HostApplication(log);
 }
 public ServiceRequestActionFilterAttribute(ApplicationEventSource source)
 {
     _source = source;
 }