public static async Task Main() { await WebHost.StartAsync(new Startup()); #region Seed Countries #endregion #region Seed Cities #endregion #region Seed Towns #endregion #region Seed Users #endregion #region Seed Images #endregion #region Seed Properties #endregion }
public async Task OnStartedServiceAsync(OperationContext context, ICacheServerServices cacheServices) { CacheServiceStartup.UseExternalServices(WebHostBuilder, context, HostParameters); WebHostBuilder.ConfigureServices(services => { services.AddSingleton <DistributedCacheServiceConfiguration>(ServiceConfiguration); if (ServiceConfiguration.ContentCache != null) { if (cacheServices.PushFileHandler != null && cacheServices.StreamStore != null) { services.AddSingleton <ContentCacheService>(sp => { return(new ContentCacheService( ServiceConfiguration.ContentCache, cacheServices.PushFileHandler, cacheServices.StreamStore)); }); } } if (UseGrpc) { services.AddSingleton(cacheServices); var grpcServiceCollection = new ServiceCollectionWrapper(services); foreach (var grpcEndpoint in cacheServices.GrpcEndpoints) { grpcEndpoint.AddServices(grpcServiceCollection); } services.AddSingleton <BinderConfiguration>(MetadataServiceSerializer.BinderConfiguration); services.AddCodeFirstGrpc(); } }); WebHost = WebHostBuilder.Build(); // Get and start the DeploymentProxyService ProxyService = WebHost.Services.GetService <DeploymentProxyService>(); ContentCacheService = WebHost.Services.GetService <ContentCacheService>(); if (ProxyService != null) { await ProxyService.StartupAsync(context).ThrowIfFailureAsync(); } if (ContentCacheService != null) { await ContentCacheService.StartupAsync(context).ThrowIfFailureAsync(); } await WebHost.StartAsync(context.Token); }
public Task StartAsync(CancellationToken cancellationToken) { LogUsefulInformation(); ProcessScannerTimer.Start(); GamesDataUpdateTimer.Start(); Task.Delay(1000).ContinueWith(x => GameStore.ReloadGamesFromCentralRepository()); WebHost.StartAsync(cancellationToken).ContinueWith((func) => PrefetchUserProfile()); Application.Run(new SystemTrayForm()); return(Task.CompletedTask); }
public async Task <int> RunAsync([NotNull] params string[] args) { if (args == null) { throw new ArgumentNullException(nameof(args)); } try { WebHost = HostBuilder.Build(); } catch (Exception ex) when(!ex.IsFatal()) { Logger.Fatal(ex, "Could not build web host {Application}", AppInstance); throw new DeployerAppException($"Could not build web host in {AppInstance}", ex); } if (args.Any(arg => arg.Equals(ApplicationConstants.RunAsService))) { Logger.Information("Starting {AppInstance} as a Windows Service", AppInstance); try { WebHost.CustomRunAsService(this); } catch (Exception ex) when(!ex.IsFatal()) { Logger.Fatal(ex, "Could not start web host as a Windows service, {AppInstance}", AppInstance); throw new DeployerAppException($"Could not start web host as a Windows service, configuration, {Configuration?.SourceChain} {AppInstance} ", ex); } } else { Logger.Information("Starting as a Console Application, {AppInstance}", AppInstance); try { await WebHost.StartAsync(CancellationTokenSource.Token); } catch (Exception ex) when(!ex.IsFatal()) { Logger.Fatal(ex, "Could not start web host, {AppInstance}", AppInstance); throw new DeployerAppException($"Could not start web host, configuration {Configuration?.SourceChain} {AppInstance}", ex); } } LogConfigurationValues(); return(0); }
public override async Task OnStart() { WebHost = Host.CreateDefaultBuilder() .ConfigureWebHostDefaults(webBuilder => webBuilder .UseStartup <WebAPIStartup>() .UseSerilog() .ConfigureKestrel(context => context.AllowSynchronousIO = true) .ConfigureServices((context, collection) => collection.AddSingleton(f => this)) .ConfigureServices((context, collection) => { collection .AddControllers() .AddNewtonsoftJson(); collection .AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(options => { var signingKey = Convert.FromBase64String(Info.TokenKey); options.TokenValidationParameters = new TokenValidationParameters { ValidateIssuer = !string.IsNullOrEmpty(Info.TokenIssuer), ValidateAudience = !string.IsNullOrEmpty(Info.TokenAudience), ValidateIssuerSigningKey = true, ValidIssuer = Info.TokenIssuer, ValidAudience = Info.TokenAudience, IssuerSigningKey = new SymmetricSecurityKey(signingKey) }; }); collection.AddSingleton <IDependencyResolver>(s => new FuncDependencyResolver(s.GetRequiredService)); collection.AddSingleton <ISchema, WebAPISchema>(); collection.AddSingleton <IUserContextBuilder, WebAPIContextBuilder>(); collection .AddGraphQL() .AddGraphTypes() .AddGraphQLAuthorization(options => { options.AddPolicy("Authorized", p => p.RequireAuthenticatedUser()); }) .AddDataLoader() .AddWebSockets(); })) .Build(); await base.OnStart(); await WebHost.StartAsync(); }
public async Task <int> RunAsync([NotNull] params string[] args) { if (args == null) { throw new ArgumentNullException(nameof(args)); } _logger.Information("Starting Arbor.SyslogServer"); WebHost = HostBuilder.Build(); await WebHost.StartAsync(_cancellationTokenSource.Token); _logger.Debug("Started webhost"); return(0); }
public async Task OnStartedServiceAsync(OperationContext context, ICacheServerServices cacheServices) { CacheServiceStartup.UseExternalServices(WebHostBuilder, context, HostParameters); WebHostBuilder.ConfigureServices(services => { if (ServiceConfiguration.ContentCache != null) { if (cacheServices.PushFileHandler != null && cacheServices.StreamStore != null) { services.AddSingleton <ContentCacheService>(sp => { return(new ContentCacheService( ServiceConfiguration.ContentCache, cacheServices.PushFileHandler, cacheServices.StreamStore)); }); } } }); WebHost = WebHostBuilder.Build(); ConfigurationSource.Configuration = WebHost.Services.GetService <ProxyServiceConfiguration>(); // Get and start the DeploymentProxyService ProxyService = WebHost.Services.GetService <DeploymentProxyService>(); ContentCacheService = WebHost.Services.GetService <ContentCacheService>(); await ProxyService.StartupAsync(context).ThrowIfFailureAsync(); if (ContentCacheService != null) { await ContentCacheService.StartupAsync(context).ThrowIfFailureAsync(); } await WebHost.StartAsync(context.Token); }
public static async Task Main() { await WebHost.StartAsync(new Startup()); }
public static async Task Main() { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; await WebHost.StartAsync(new Startup()); }
public static async Task Main(string[] args) { await WebHost.StartAsync(new StartUp()); }
public static async Task Main() { //Changed the port in WebHost to 8000, because it gives me error on port 80 await WebHost.StartAsync(new Startup()); }
public static async Task Main() { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("EN-US"); await WebHost.StartAsync(new Startup()); }
public static async Task Main() { //the front seats arent counted as free seats => seats = seats - 2 await WebHost.StartAsync(new Startup()); }