diff --git a/src/bundles/Elsa.AllInOne.Web/Program.cs b/src/bundles/Elsa.AllInOne.Web/Program.cs index 423bddd16..f2c303c9f 100644 --- a/src/bundles/Elsa.AllInOne.Web/Program.cs +++ b/src/bundles/Elsa.AllInOne.Web/Program.cs @@ -4,9 +4,11 @@ using Elsa.Identity; using Elsa.Identity.Options; using Elsa.EntityFrameworkCore.Modules.ActivityDefinitions; using Elsa.EntityFrameworkCore.Modules.Labels; +using Elsa.EntityFrameworkCore.Modules.Management; using Elsa.EntityFrameworkCore.Modules.Runtime; using Elsa.Requirements; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; var builder = WebApplication.CreateBuilder(args); builder.WebHost.UseStaticWebAssets(); @@ -31,10 +33,12 @@ services identity.TokenOptions = identityTokenOptions; }) .UseDefaultAuthentication() + .UseWorkflowManagement(management => management.UseEntityFrameworkCore(ef => ef.UseSqlite(sqliteConnectionString))) .UseWorkflowRuntime(runtime => { runtime.UseDefaultRuntime(dr => dr.UseEntityFrameworkCore(ef => ef.UseSqlite(sqliteConnectionString))); runtime.UseExecutionLogRecords(e => e.UseEntityFrameworkCore(ef => ef.UseSqlite(sqliteConnectionString))); + runtime.UseAsyncWorkflowStateExporter(); }) .UseLabels(labels => labels.UseEntityFrameworkCore(ef => ef.UseSqlite(sqliteConnectionString))) .UseActivityDefinitions(feature => feature.UseEntityFrameworkCore(ef => ef.UseSqlite(sqliteConnectionString))) @@ -49,9 +53,10 @@ services.AddHealthChecks(); services.AddHttpContextAccessor(); services.AddSingleton(); services.AddAuthorization(options => options.AddPolicy(IdentityPolicyNames.SecurityRoot, policy => policy.AddRequirements(new LocalHostRequirement()))); +services.AddCors(cors => cors.AddDefaultPolicy(policy => policy.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin())); // Razor Pages. -services.AddRazorPages(); +services.AddRazorPages(options => options.Conventions.ConfigureFilter(new IgnoreAntiforgeryTokenAttribute())); // Configure middleware pipeline. var app = builder.Build(); @@ -65,17 +70,12 @@ if (!app.Environment.IsDevelopment()) } app.UseHttpsRedirection(); +app.UseCors(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseWorkflowsApi(); app.UseWorkflows(); - -app.UseEndpoints(endpoints => -{ - endpoints.MapFallbackToPage("/Index"); -}); - app.MapRazorPages(); app.Run(); \ No newline at end of file