Skip to content

Instantly share code, notes, and snippets.

Created May 27, 2019 03:08
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.ServiceProcess;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Hosting.WindowsServices;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace ravendemo
public class Program
public static void Main(string[] args)
var host = CreateWebHostBuilder(args).Build();
var isService = args.Contains("--service");
if (isService)
var baseDirectory = new FileInfo(Assembly.GetEntryAssembly().Location).Directory.FullName;
if (isService)
ServiceBase.Run(new WebHostService(host));
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment