elsa-workflows / elsa-workflows/elsa-core
ASP.NET Core sample ElsaWeb cannot run successfully.
- Dominant language
- C#
- Stars
- 7.9k
- Forks
- 1.5k
- Avg merge
- 15h 22m
- Merged PRs (30d)
- 114
Description
## Description
Created according to the sample requirements, the compilation has an error in the "elsa.UseHttp();" line and an error in "using Elsa.Workflows.Contracts;".
After adding Elsa.Http and commenting "using Elsa.Workflows.Contracts;", it can be compiled, but 404 appears when outputting /hello-world in the browser.
There are many problems with the sample, and even a simple sample cannot be compiled and run normally.
## Steps to Reproduce
To help us identify the issue more quickly, please follow these guidelines:
1. **Detailed Steps**: Provide a step-by-step description of what leads to the bug. Be as specific as possible.
1).create the Project
Create a new empty ASP.NET app using the following command:
dotnet new web -n "ElsaWeb"
2).Add Packages
Navigate to your project's root directory and install the Elsa package:
cd ElsaWeb
dotnet add package Elsa
3).Modify Program.cs
Open Program.cs in your project and replace its contents with the code provided below.
using Elsa.Extensions;
using ElsaWeb.Workflows;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddElsa(elsa =>
{
elsa.AddWorkflow();
elsa.UseHttp();
});
var app = builder.Build();
// Configure the HTTP request pipeline.
app.UseWorkflows();
app.Run();
Add HttpHelloWorld Workflow
4).Create a new directory called Workflows and add a new file to it called HttpHelloWorld.cs with the following.
using Elsa.Http;
using Elsa.Workflows;
using Elsa.Workflows.Activities;
using Elsa.Workflows.Contracts;
namespace ElsaWeb.Workflows;
public class HttpHelloWorld : WorkflowBase
{
protected override void Build(IWorkflowBuilder builder)
{
builder.Root = new Sequence
{
Activities =
{
new HttpEndpoint
{
Path = new("/hello-world"),
CanStartWorkflow = true
},
new WriteHttpResponse
{
Content = new("Hello world of HTTP workflows!")
}
}
};
}
}
## build error
The type or namespace name "Contracts" does not exist in the namespace "Elsa.Workflows" (are you missing an assembly reference?)
The type or namespace name "Http" does not exist in the namespace "Elsa" (are you missing an assembly reference?)
The type or namespace name "HttpEndpoint" could not be found (are you missing a using directive or assembly reference?)
The type or namespace name "WriteHttpResponse" could not be found (are you missing a using directive or assembly reference?)
## Environment
elsa 3.3.5, vs2022 ,net 8.0
## run error
adding Elsa.Http package and commenting "using Elsa.Workflows.Contracts;", it can be compiled, but 404 appears when outputting /hello-world in the browser.
Contributor guide
Research direction
Reproduce the sample from the issue with .NET 8 and Elsa 3.3.5, starting with the package commands and Program.cs. Then inspect Workflows/HttpHelloWorld.cs and verify the Elsa.Http references, compilation, and /hello-world response; done means the sample builds and no longer returns 404.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100