diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/Program.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/Program.cs index 9a8952adf3..75a2365b93 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/Program.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/Program.cs @@ -40,6 +40,11 @@ public class Program } catch (Exception ex) { + if (ex is HostAbortedException) + { + throw; + } + Log.Fatal(ex, "MyCompanyName.MyProjectName.AuthServer terminated unexpectedly!"); return 1; } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/Program.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/Program.cs index d4399ec884..172ee21326 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/Program.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/Program.cs @@ -40,6 +40,11 @@ public class Program } catch (Exception ex) { + if (ex is HostAbortedException) + { + throw; + } + Log.Fatal(ex, "Host terminated unexpectedly!"); return 1; } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/Program.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/Program.cs index 6e2f2085dc..9dad784c5a 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/Program.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/Program.cs @@ -40,6 +40,11 @@ public class Program } catch (Exception ex) { + if (ex is HostAbortedException) + { + throw; + } + Log.Fatal(ex, "Host terminated unexpectedly!"); return 1; } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/Program.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/Program.cs index 149b9ad46d..606f35b00f 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/Program.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/Program.cs @@ -40,6 +40,11 @@ public class Program } catch (Exception ex) { + if (ex is HostAbortedException) + { + throw; + } + Log.Fatal(ex, "Host terminated unexpectedly!"); return 1; } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/Program.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/Program.cs index 149b9ad46d..606f35b00f 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/Program.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/Program.cs @@ -40,6 +40,11 @@ public class Program } catch (Exception ex) { + if (ex is HostAbortedException) + { + throw; + } + Log.Fatal(ex, "Host terminated unexpectedly!"); return 1; } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Program.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Program.cs index 7894ee68b6..b3a2c406f0 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Program.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Program.cs @@ -40,6 +40,11 @@ public class Program } catch (Exception ex) { + if (ex is HostAbortedException) + { + throw; + } + Log.Fatal(ex, "Host terminated unexpectedly!"); return 1; } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Program.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Program.cs index 7894ee68b6..b3a2c406f0 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Program.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Program.cs @@ -40,6 +40,11 @@ public class Program } catch (Exception ex) { + if (ex is HostAbortedException) + { + throw; + } + Log.Fatal(ex, "Host terminated unexpectedly!"); return 1; } diff --git a/templates/console/src/MyCompanyName.MyProjectName/Program.cs b/templates/console/src/MyCompanyName.MyProjectName/Program.cs index 36fe5a13a4..9ed46f9fae 100644 --- a/templates/console/src/MyCompanyName.MyProjectName/Program.cs +++ b/templates/console/src/MyCompanyName.MyProjectName/Program.cs @@ -49,6 +49,11 @@ public class Program } catch (Exception ex) { + if (ex is HostAbortedException) + { + throw; + } + Log.Fatal(ex, "Host terminated unexpectedly!"); return 1; } diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Program.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Program.cs index 4e968eb684..6375c4e62d 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Program.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Program.cs @@ -40,6 +40,11 @@ public class Program } catch (Exception ex) { + if (ex is HostAbortedException) + { + throw; + } + Log.Fatal(ex, "Host terminated unexpectedly!"); return 1; } diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Program.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Program.cs index c7f18ffe4a..46d2454c0c 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Program.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Program.cs @@ -40,6 +40,11 @@ public class Program } catch (Exception ex) { + if (ex is HostAbortedException) + { + throw; + } + Log.Fatal(ex, "Host terminated unexpectedly!"); return 1; } diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Program.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Program.cs index be11164285..a96dbd92ff 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Program.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Program.cs @@ -40,6 +40,11 @@ public class Program } catch (Exception ex) { + if (ex is HostAbortedException) + { + throw; + } + Log.Fatal(ex, "Host terminated unexpectedly!"); return 1; } diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/Program.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/Program.cs index e638a0176b..0760876504 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/Program.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/Program.cs @@ -43,6 +43,11 @@ public class Program } catch (Exception ex) { + if (ex is HostAbortedException) + { + throw; + } + Log.Fatal(ex, "Host terminated unexpectedly!"); return 1; } diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Program.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Program.cs index 0e0b569886..f095437ea7 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Program.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Program.cs @@ -43,6 +43,11 @@ public class Program } catch (Exception ex) { + if (ex is HostAbortedException) + { + throw; + } + Log.Fatal(ex, "Host terminated unexpectedly!"); return 1; }