コード例 #1
0
        public static void Register()
        {
            ServiceRuntime.RegisterServiceAsync(
                Naming.ServiceType <RestApi>(),
                (context) =>
            {
                ConfigurationPackage configPackage = context.CodePackageActivationContext.GetConfigurationPackageObject(@"Config");
                ILogger serilog = new LoggerConfiguration()
                                  .WriteTo.Seq(configPackage.Settings.Sections[@"ResourceSettings"].Parameters[@"seqLocation"].Value)
                                  .CreateLogger();
                Log.Logger = serilog;
                return(new RestApi(context, serilog.Enrich <RestApi>(context)));
            })
            .GetAwaiter().GetResult();

            ServiceEventSource.Current.ServiceTypeRegistered(
                Process.GetCurrentProcess().Id,
                Naming.ServiceType <RestApi>());
        }