Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions aspnetcore/hosting/windows-service/sample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@ public static void Main(string[] args)
var pathToExe = Process.GetCurrentProcess().MainModule.FileName;
var pathToContentRoot = Path.GetDirectoryName(pathToExe);

var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(pathToContentRoot)
.UseIISIntegration()
.UseStartup<Startup>()
.UseApplicationInsights()
.Build();

var host = WebHost.CreateDefaultBuilder(args)
.UseContentRoot(pathToContentRoot)
.UseStartup<Startup>()
.UseApplicationInsights()
.Build();
host.RunAsService();
}
#endregion
Expand All @@ -45,13 +42,11 @@ public static void Main(string[] args)
pathToContentRoot = Path.GetDirectoryName(pathToExe);
}

var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(pathToContentRoot)
.UseIISIntegration()
.UseStartup<Startup>()
.UseApplicationInsights()
.Build();
var host = WebHost.CreateDefaultBuilder(args)
.UseContentRoot(pathToContentRoot)
.UseStartup<Startup>()
.UseApplicationInsights()
.Build();

if (isService)
{
Expand Down