public async Task <bool> UpdateDefaultApplicationAsync(string id, WebApplicationConfig body = null, CancellationToken cancellationToken = default) { var response = await GetWebApplicationConfigurationDefaultApplicationUrl() .AppendPathSegment(id) .PutJsonAsync(body, cancellationToken) .ConfigureAwait(false); return(response.IsSuccessStatusCode); }
public async Task <EntityShortRepresentation> CreateWebApplicationAsync(WebApplicationConfig body = null, CancellationToken cancellationToken = default) { var result = await GetWebApplicationConfigurationWebApplicationUrl() .PostJsonAsync(body, cancellationToken) .ReceiveJsonWithErrorChecking <EntityShortRepresentation>() .ConfigureAwait(false); return(result); }
public async Task <EntityShortRepresentation> UpdateWebApplicationAsync(string id, WebApplicationConfig body = null, CancellationToken cancellationToken = default) { var result = await GetWebApplicationConfigurationWebApplicationUrl() .AppendPathSegment(id) .PutJsonAsync(body, cancellationToken) .ReceiveJsonWithErrorChecking <EntityShortRepresentation>() .ConfigureAwait(false); return(result); }
private static int Main() { Type launcherType = Type.GetType(ConfigurationManager.AppSettings["launcherType"]); if (launcherType == null) { throw new Exception("The launcher type setting must be defined."); } TopshelfExitCode exitCode = HostFactory.Run(hostConfigurator => { WebApplicationConfig config = WebApplicationConfig.TryLoadOrNewWebRunnerConfig(); hostConfigurator.AddCommandLineDefinition("useSSL", useSSLArgument => { config.UseSSL = bool.Parse(useSSLArgument); }); hostConfigurator.AddCommandLineDefinition("isLocalMode", isLocalModeArgument => { config.IsLocalMode = bool.Parse(isLocalModeArgument); }); hostConfigurator.AddCommandLineDefinition("port", portArgument => { config.Port = int.Parse(portArgument); }); hostConfigurator.ApplyCommandLine(); hostConfigurator.Service <WebApplicationLauncherAdapter>(s => { s.ConstructUsing(hostSettings => new WebApplicationLauncherAdapter(launcherType)); s.WhenStarted(o => o.Start(config)); s.WhenStopped(o => o.Stop()); s.AfterStartingService(() => { if (!config.OpenBrowser) { return; } Process.Start(new ProcessStartInfo("cmd", $"/c start {config.GetUrl()}") { CreateNoWindow = true }); }); }); hostConfigurator.RunAsNetworkService(); hostConfigurator.StartAutomatically(); hostConfigurator.SetServiceName("ContentTransformer"); hostConfigurator.SetDescription($"Content Transformer Service (v{Assembly.GetExecutingAssembly().GetName().Version})"); hostConfigurator.SetDisplayName($"Content Transformer - {config.GetUrl()}"); hostConfigurator.OnException(exception => { Console.ForegroundColor = ConsoleColor.Red; while (true) { if (exception == null) { break; } Console.WriteLine(exception.Message); exception = exception.InnerException; } Console.ResetColor(); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); }); }); return((int)exitCode); }