diff --git a/ChaosBot/ChaosBot.csproj b/ChaosBot/ChaosBot.csproj index 67c2ad6..fc6a36e 100644 --- a/ChaosBot/ChaosBot.csproj +++ b/ChaosBot/ChaosBot.csproj @@ -23,13 +23,14 @@ - - PreserveNewest - + + PreserveNewest + + diff --git a/ChaosBot/WebServer/Startup.cs b/ChaosBot/WebServer/Startup.cs index 747084c..c36d89e 100644 --- a/ChaosBot/WebServer/Startup.cs +++ b/ChaosBot/WebServer/Startup.cs @@ -1,3 +1,4 @@ +using System.IO; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; @@ -36,7 +37,6 @@ namespace ChaosBot.WebServer { _logger.Info("Initializing Kestrel Startup and Configuration"); - if (Program.AppSettingsHandler.GetValue("WebServer:Debug", false)) app.UseDeveloperExceptionPage(); @@ -45,6 +45,12 @@ namespace ChaosBot.WebServer app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); + + DefaultFilesOptions options = new DefaultFilesOptions(); + options.DefaultFileNames.Clear(); + options.DefaultFileNames.Add("index.html"); + app.UseDefaultFiles(options); + app.UseStaticFiles(); } } } \ No newline at end of file diff --git a/ChaosBot/WebServer/WebServer.cs b/ChaosBot/WebServer/WebServer.cs index c3a3970..7fd0420 100644 --- a/ChaosBot/WebServer/WebServer.cs +++ b/ChaosBot/WebServer/WebServer.cs @@ -1,3 +1,4 @@ +using System.IO; using System.Net; using NLog.Extensions.Logging; @@ -19,6 +20,11 @@ namespace ChaosBot.WebServer Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { + string contentRoot = Directory.GetCurrentDirectory(); + string webRoot = Path.Combine(contentRoot, "wwwroot"); + + webBuilder.UseContentRoot(contentRoot); + webBuilder.UseWebRoot(webRoot); webBuilder.ConfigureKestrel(serverOptions => { serverOptions.Listen(IPAddress.Any, Program.AppSettingsHandler.GetValue("WebServer:Port"), diff --git a/ChaosBot/wwwroot/index.html b/ChaosBot/wwwroot/index.html new file mode 100644 index 0000000..03d0864 --- /dev/null +++ b/ChaosBot/wwwroot/index.html @@ -0,0 +1,13 @@ + + + + + + + Document + + +

Index

+ + \ No newline at end of file