diff --git a/src/OrchardCoreContrib.Diagnostics.Elm/Constants.cs b/src/OrchardCoreContrib.Diagnostics.Elm/Constants.cs new file mode 100644 index 00000000..eb175341 --- /dev/null +++ b/src/OrchardCoreContrib.Diagnostics.Elm/Constants.cs @@ -0,0 +1,6 @@ +namespace OrchardCoreContrib.Diagnostics.Elm; + +public class Constants +{ + public const string ConfigurationKey = "OrchardCoreContrib_Diagnostics_Elm"; +} diff --git a/src/OrchardCoreContrib.Diagnostics.Elm/Manifest.cs b/src/OrchardCoreContrib.Diagnostics.Elm/Manifest.cs index 48fadefa..41744de7 100644 --- a/src/OrchardCoreContrib.Diagnostics.Elm/Manifest.cs +++ b/src/OrchardCoreContrib.Diagnostics.Elm/Manifest.cs @@ -5,7 +5,7 @@ Name = "Elm Diagnostics", Author = ManifestConstants.Author, Website = ManifestConstants.Website, - Version = "1.4.1", - Description = "Provides services to handle errors using Elm.", + Version = "1.6.0", + Description = "Provides services to handle errors using ASP.NET Core Error Logging Middleware (ELM).", Category = "Infrastructure" )] diff --git a/src/OrchardCoreContrib.Diagnostics.Elm/OrchardCoreContrib.Diagnostics.Elm.csproj b/src/OrchardCoreContrib.Diagnostics.Elm/OrchardCoreContrib.Diagnostics.Elm.csproj index 23151ae8..1215f608 100644 --- a/src/OrchardCoreContrib.Diagnostics.Elm/OrchardCoreContrib.Diagnostics.Elm.csproj +++ b/src/OrchardCoreContrib.Diagnostics.Elm/OrchardCoreContrib.Diagnostics.Elm.csproj @@ -1,10 +1,11 @@  - 1.5.0 + 1.6.0 The Orchard Core Contrib Team Provides services to handle errors using Elm. + README.md BSD-3-Clause https://github.com/OrchardCoreContrib/OrchardCoreContrib.Modules/tree/main/src/OrchardCoreContrib.Diagnostics.Elm/README.md https://github.com/OrchardCoreContrib/OrchardCoreContrib.Modules @@ -21,6 +22,7 @@ + diff --git a/src/OrchardCoreContrib.Diagnostics.Elm/README.md b/src/OrchardCoreContrib.Diagnostics.Elm/README.md index aa532c49..1e76659d 100644 --- a/src/OrchardCoreContrib.Diagnostics.Elm/README.md +++ b/src/OrchardCoreContrib.Diagnostics.Elm/README.md @@ -1,10 +1,10 @@ # Elm Diagnostics Module -This module handle and logs errors using Elm. +This module handle and logs errors using ASP.NET Core Error Logging Middleware (ELM). ## Version -1.4.1 +1.6.0 ## Category @@ -26,6 +26,7 @@ This module has no dependencies. | Name | Version | |-----------------------------------------------------------------------------------------------------------------|---------| +| [`OrchardCoreContrib.Diagnostics.Elm`](https://www.nuget.org/packages/OrchardCoreContrib.Diagnostics.Elm/1.6.0) | 1.6.0 | | [`OrchardCoreContrib.Diagnostics.Elm`](https://www.nuget.org/packages/OrchardCoreContrib.Diagnostics.Elm/1.5.0) | 1.5.0 | | [`OrchardCoreContrib.Diagnostics.Elm`](https://www.nuget.org/packages/OrchardCoreContrib.Diagnostics.Elm/1.4.1) | 1.4.1 | | [`OrchardCoreContrib.Diagnostics.Elm`](https://www.nuget.org/packages/OrchardCoreContrib.Diagnostics.Elm/1.4.0) | 1.4.0 | @@ -41,4 +42,4 @@ This module has no dependencies. 3. Select **Configuration -> Features** menu. 4. Enable the `Elm Diagnostics` feature. 5. Go to the site. -6. Visit the ELm end-point by append `/elm` to the URL. +6. Visit the ELm end-point by append `/elm` to the URL. In case you need to change the path, set the `Path` property of the `OrchardCoreContrib_Diagnostics_Elm` settings section from within `appsettings.json`. diff --git a/src/OrchardCoreContrib.Diagnostics.Elm/Startup.cs b/src/OrchardCoreContrib.Diagnostics.Elm/Startup.cs index a8ad6465..5a5428c3 100644 --- a/src/OrchardCoreContrib.Diagnostics.Elm/Startup.cs +++ b/src/OrchardCoreContrib.Diagnostics.Elm/Startup.cs @@ -1,28 +1,28 @@ using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Diagnostics.Elm; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; +using OrchardCore.Environment.Shell.Configuration; using OrchardCore.Modules; -using System; -namespace OrchardCoreContrib.Diagnostics.Elm +namespace OrchardCoreContrib.Diagnostics.Elm; + +/// +/// Represensts a startup point to register the required services by Elm diagnostics module. +/// +public class Startup(IShellConfiguration shellConfiguration) : StartupBase { - /// - /// Represensts a startup point to register the required services by Elm diagnostics module. - /// - public class Startup : StartupBase + /// + public override void ConfigureServices(IServiceCollection services) { - /// - public override void ConfigureServices(IServiceCollection services) - { - services.AddElm(options => options.Path = new PathString("/elm")); - } + services.Configure(shellConfiguration.GetSection(Constants.ConfigurationKey)); + + services.AddElm(); + } - /// - public override void Configure(IApplicationBuilder builder, IEndpointRouteBuilder routes, IServiceProvider serviceProvider) - { - builder.UseElmCapture(); - builder.UseElmPage(); - } + /// + public override void Configure(IApplicationBuilder builder, IEndpointRouteBuilder routes, IServiceProvider serviceProvider) + { + builder.UseElmPage(); } } diff --git a/src/OrchardCoreContrib.Modules.Web/Startup.cs b/src/OrchardCoreContrib.Modules.Web/Startup.cs index b0cee2de..7e2ccba3 100644 --- a/src/OrchardCoreContrib.Modules.Web/Startup.cs +++ b/src/OrchardCoreContrib.Modules.Web/Startup.cs @@ -1,41 +1,40 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using OrchardCore.Environment.Shell; +using Microsoft.AspNetCore.Server.Kestrel.Core; using OrchardCoreContrib.Users.Services; -namespace OrchardCoreContrib.Modules.Web +namespace OrchardCoreContrib.Modules.Web; + +public class Startup { - public class Startup + public void ConfigureServices(IServiceCollection services) { - public void ConfigureServices(IServiceCollection services) - { - services - .AddOrchardCms(builder => - { - builder.AddSetupFeatures("OrchardCore.AutoSetup", "OrchardCoreContrib.Tenants"); - //builder.ConfigureServices(builderServices => - //{ - // builderServices.AddYesSqlDataMigrations(); + // Fix IOE Synchronous operations are disallowed + services.Configure(options => options.AllowSynchronousIO = true); + services.Configure(options => options.AllowSynchronousIO = true); - // builderServices.AddScoped(); - // builderServices.AddScoped(sp => sp.GetRequiredService()); - //}); - }); + services + .AddOrchardCms(builder => + { + builder.AddSetupFeatures("OrchardCore.AutoSetup", "OrchardCoreContrib.Tenants"); + //builder.ConfigureServices(builderServices => + //{ + // builderServices.AddYesSqlDataMigrations(); - // Workaround to avoid IOE on UserMenu shape - services.AddScoped(); - } + // builderServices.AddScoped(); + // builderServices.AddScoped(sp => sp.GetRequiredService()); + //}); + }); - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } + // Workaround to avoid IOE on UserMenu shape + services.AddScoped(); + } - app.UseOrchardCore(); + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); } + + app.UseOrchardCore(); } } diff --git a/src/OrchardCoreContrib.Modules.Web/appsettings.json b/src/OrchardCoreContrib.Modules.Web/appsettings.json index 0230a6cf..f42cc747 100644 --- a/src/OrchardCoreContrib.Modules.Web/appsettings.json +++ b/src/OrchardCoreContrib.Modules.Web/appsettings.json @@ -39,6 +39,9 @@ } ] }, + //"OrchardCoreContrib_Diagnostics_Elm": { + // "Path": "/elm" + //}, //"OrchardCoreContrib_HealthChecks": { // "Url": "/health", // "ShowDetails": true