Elsa 工作流设计器错误

Elsa workflow designer errors

我已完成以下教程以正确配置工作的 elsa 服务器

Part 2 of Building Workflow Driven .NET Applications with Elsa 2

我对 运行 进行了修改,使用 docker-compose 以及相关服务。

除设计器中的智能感知外,一切都按预期工作window。

我注意到浏览器控制台中有几个错误,如下所示

这是我的创业公司class

  public class Startup
    {
        public Startup(IConfiguration configuration, IWebHostEnvironment environment)
        {
            Configuration = configuration;
            Environment = environment;
        }

        private IConfiguration Configuration { get; }
        private IWebHostEnvironment Environment { get; }

        public void ConfigureServices(IServiceCollection services)
        {
            var dbConnectionString = Configuration.GetConnectionString("Sqlite");

            // Razor Pages (for UI).
            services.AddRazorPages();

            // Hangfire (for background tasks).
            AddHangfire(services, dbConnectionString);

            // Elsa (workflows engine).
            AddWorkflowServices(services, dbConnectionString);

            // Allow arbitrary client browser apps to access the API for demo purposes only.
            // In a production environment, make sure to allow only origins you trust.
            services.AddCors(cors => cors.AddDefaultPolicy(policy => policy.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin().WithExposedHeaders("Content-Disposition")));
        }

        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                app.UseHsts();
            }

            app
                .UseStaticFiles()
                .UseCors(cors => cors
                    .AllowAnyHeader()
                    .AllowAnyMethod()
                    .SetIsOriginAllowed(_ => true)
                    .AllowCredentials())
                .UseRouting()
                .UseHttpActivities() // Install middleware for triggering HTTP Endpoint activities. 
                .UseEndpoints(endpoints =>
                {
                    endpoints.MapRazorPages();
                    endpoints.MapControllers(); // Elsa API Endpoints are implemented as ASP.NET API controllers.
                });
        }

        private void AddHangfire(IServiceCollection services, string dbConnectionString)
        {
            services
                .AddHangfire(config => config
                    // Use same SQLite database as Elsa for storing jobs. 
                    .UseSQLiteStorage(dbConnectionString)
                    .UseSimpleAssemblyNameTypeSerializer()

                    // Elsa uses NodaTime primitives, so Hangfire needs to be able to serialize them.
                    .UseRecommendedSerializerSettings(settings => settings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb)))
                .AddHangfireServer((sp, options) =>
                {
                    // Bind settings from configuration.
                    Configuration.GetSection("Hangfire").Bind(options);

                    // Configure queues for Elsa workflow dispatchers.
                    options.ConfigureForElsaDispatchers(sp);
                });
        }

        private void AddWorkflowServices(IServiceCollection services, string dbConnectionString)
        {
            services.AddWorkflowServices(dbContext => dbContext.UseSqlite(dbConnectionString));

            // Configure SMTP.
            services.Configure<SmtpOptions>(options => Configuration.GetSection("Elsa:Smtp").Bind(options));

            // Configure HTTP activities.
            services.Configure<HttpActivityOptions>(options => Configuration.GetSection("Elsa:Server").Bind(options));

            // Elsa API (to allow Elsa Dashboard to connect for checking workflow instances).
            services.AddElsaApiEndpoints();
        }
    }

这是我的docker撰写

version: '3.4'

services:
  workflow.web:
    image: ${DOCKER_REGISTRY-}workflowweb
    ports:
        - 5000:80
        - 5001:443
    build:
      context: .
      dockerfile: src/Workflow.Web/Dockerfile
    networks:
        - testnet

  email.service:
     image: rnwood/smtp4dev:linux-amd64-3.1.0-ci0856
     ports:
        - 3000:80
        - "2525:25"
     networks:
        - testnet

  elsa.dashboard:
     image: elsaworkflows/elsa-dashboard:latest
     ports:
        - "14000:80"
     environment:
        ELSA__SERVER__BASEADDRESS: "http://localhost:5000"
     networks:
        - testnet


networks:
  testnet:
    driver: bridge

任何想法

最有可能的问题是仪表板的 docker 图像与您的应用程序托管的工作流服务器不兼容。

这种不匹配的原因是博客 post 引用了 Elsa 2.3 NuGet 包,而仪表板 docker 图像是从 master 分支中的最新源代码构建的(这是应该修复以避免像您遇到的混淆)。

要使仪表板正常工作(它是根据最新的源代码构建的),您需要更新您的工作流服务器应用程序以引用来自 MyGet 的最新 Elsa 预览包(它们也是根据来自 master 分支的最新源代码构建的) ).

以下文档介绍了如何引用 MyGet 提要:https://elsa-workflows.github.io/elsa-core/docs/next/installation/installing-feeds#myget