MODULE 01 · LESSON 1.2
Create the solution and start the host
Start a standalone FabrCore Host with in-memory runtime state.
Lesson 2 of 86 · FabrCore 2.0
Overview
The smallest Host is an ASP.NET Core app with two FabrCore extension calls. Localhost clustering is useful because there are no membership tables, database migrations or cloud credentials to provision. State has process lifetime at this milestone.
What the startup calls register
AddFabrCoreServer runs while building the application and installs FabrCore's runtime services and Orleans integration. UseFabrCoreServer wires the built app's FabrCore HTTP surface. The agent library must be referenced by the Host so its types can be discovered. Creating a class library on disk alone does not make its agents available to the running process.
What standalone means here
Localhost clustering lets one development machine run without a membership database. With the standalone configuration used here, runtime state is process-local. A successful start does not promise restart persistence. Keep this Host running while you use a second terminal for the client; starting another sample Host on the same Orleans ports can fail even if its HTTP port differs.
Create and run the host
Download the Operations Desk source. The README lists project setup, package prerequisites and local ports.
- Create the server and agent projects with the commands below. Use matching available FabrCore 2.0 packages; if stable packages are not in your feed, use the source build/local-feed workflow described in the download README.
- Replace OperationsDesk.Server/Program.cs and appsettings.json with the examples. This tour uses port 5098 consistently for the standalone Host.
- Run the server from the solution directory with dotnet run --project OperationsDesk.Server --urls http://localhost:5098. Leave it running while using a second terminal.
dotnet new web -n OperationsDesk.Server -f net10.0
dotnet new classlib -n OperationsDesk.Agents -f net10.0
dotnet add OperationsDesk.Server package FabrCore.Host --version 2.0.0
dotnet add OperationsDesk.Agents package FabrCore.Sdk --version 2.0.0
dotnet add OperationsDesk.Server reference OperationsDesk.Agents
using FabrCore.Host;
var builder = WebApplication.CreateBuilder(args);
builder.AddFabrCoreServer();
var app = builder.Build();
app.UseFabrCoreServer();
app.Run();
{
"FabrCore": {
"HostUrl": "http://localhost:5098",
"Orleans": {
"ClusterId": "operations-desk",
"ServiceId": "operations-desk",
"ClusteringMode": "Localhost"
}
}
}
dotnet run --project OperationsDesk.Server --urls http://localhost:5098
# In another terminal:
Invoke-RestMethod http://localhost:5098/fabrcoreapi/discovery
Check the listening address and discovery
- Run the Host and look for “Now listening on: http://localhost:5098” in its terminal. If another address appears, use that address consistently or correct the launch configuration before continuing.
- In a second terminal, request http://localhost:5098/fabrcoreapi/discovery. Expect a successful HTTP response containing the discovery document, not a browser page or a connection-refused error.
- The ops-echo alias will not exist until you add the class in lesson 1.3. Keep the server terminal open so a startup failure is distinguishable from a discovery or client error.
A responding discovery endpoint establishes that the Host and HTTP routing are available. It does not yet establish that your application agent exists or that a model is configured.
If the result is different
Keep ConnectionStrings:FabrCore absent for standalone. A configured but invalid feature database fails startup; it does not silently fall back to memory.
Go deeper
Explore the related documentation.