|
9 | 9 | using System.Linq; |
10 | 10 | using System.Runtime.InteropServices; |
11 | 11 | using System.Threading.Tasks; |
| 12 | +using Microsoft.Extensions.Logging; |
12 | 13 |
|
13 | 14 | namespace NetCoreStack.Hisar.WebCli.Tools |
14 | 15 | { |
@@ -126,10 +127,27 @@ await Task.Run(() => |
126 | 127 | contentRoot = PathUtility.GetRootPath(true); |
127 | 128 | #endif |
128 | 129 | var hostBuilder = new WebHostBuilder() |
| 130 | + .UseKestrel(options => options.AddServerHeader = false) |
129 | 131 | .UseContentRoot(contentRoot) |
130 | 132 | .UseUrls(_urls.ToArray()) |
131 | | - .UseKestrel(options => options.AddServerHeader = false) |
132 | | - .UseIISIntegration() |
| 133 | + .ConfigureAppConfiguration((hostingContext, config) => |
| 134 | + { |
| 135 | + var env = hostingContext.HostingEnvironment; |
| 136 | + config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) |
| 137 | + .AddJsonFile($"appsettings.{env.EnvironmentName}.json", |
| 138 | + optional: true, reloadOnChange: true); |
| 139 | + |
| 140 | + config.AddEnvironmentVariables(); |
| 141 | + }) |
| 142 | + .ConfigureLogging((webHostBuilderContext, logging) => |
| 143 | + { |
| 144 | + IConfiguration configuration = webHostBuilderContext.Configuration; |
| 145 | + ILoggingBuilder loggerBuilder = logging; |
| 146 | + |
| 147 | + loggerBuilder.AddConfiguration(configuration.GetSection("Logging")); |
| 148 | + loggerBuilder.AddConsole(); |
| 149 | + loggerBuilder.AddDebug(); |
| 150 | + }) |
133 | 151 | .UseStartup<Startup>(); |
134 | 152 | #if RELEASE |
135 | 153 | hostBuilder.UseWebRoot(PathUtility.GetRootPath()); |
|
0 commit comments