Furion.Hosting 6.0.0-preview.2

This is a prerelease version of Furion.Hosting.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Furion.Hosting --version 6.0.0-preview.2
                    
NuGet\Install-Package Furion.Hosting -Version 6.0.0-preview.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Furion.Hosting" Version="6.0.0-preview.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Furion.Hosting" Version="6.0.0-preview.2" />
                    
Directory.Packages.props
<PackageReference Include="Furion.Hosting" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Furion.Hosting --version 6.0.0-preview.2
                    
#r "nuget: Furion.Hosting, 6.0.0-preview.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Furion.Hosting@6.0.0-preview.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Furion.Hosting&version=6.0.0-preview.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Furion.Hosting&version=6.0.0-preview.2&prerelease
                    
Install as a Cake Tool

Furion

ASP.NET Core 的运行时插件微内核

一切皆插件 · 热插拔 · 自动发现 · 安装即生效 · 卸载零残留

版本:6.0 · 面向 .NET 11

简介

Furion 让功能以插件形式独立交付:安装即生效,停用即下线,卸载即清理,不重启应用,也不改宿主代码。

一套系统可以按客户、版本或场景组合能力;新功能上线不再需要整站发版,出问题的功能可以单独停用、快速回退。

插件可独立开发、构建、升级与发布,团队围绕插件边界协作。Furion 不是又一个 Web 框架,而是让 ASP.NET Core 应用获得运行时扩展能力的基础设施。

特性

  • 一切皆插件:功能拆成插件,按客户、版本与场景自由组合。
  • 热插拔:安装、启用、停用、重载、升级与卸载都在运行中完成,不中断业务。
  • 自动发现:插件放入即被识别,安装与开发都不需要手工登记。
  • 安装即生效:装好即对外提供能力,宿主不需要重新发布。
  • 卸载零残留:移除即恢复干净状态,不留文件、端口与后台进程。
  • 安全隔离:插件独立运行,单个插件出错或失联不影响其他插件。
  • 多形态交付:后端接口、前端资源、独立站点与进程服务,都可以插件化。
  • 统一工具链:开发、打包、安装、升级与诊断,一套工具完成。
  • 开放扩展:插件只面向公开接口开发,内外部团队与第三方生态都能参与。

架构

        ┌──────────────────────────────────────────┐
        │              ASP.NET Core 宿主            │
        └───────────────────┬──────────────────────┘
                            │ AddFurion() + UseFurion()
        ┌───────────────────▼──────────────────────┐
        │               Furion(大脑)              │
        │   发现 / 装载 / 激活 / 调用 / 通讯 / 卸载  │
        └─────────┬───────────────────────┬────────┘
                  │                       │
   ┌──────────────▼───────────┐  ┌────────▼─────────────────┐
   │   Furion.Abstractions    │  │     Furion.Hosting       │
   │   插件契约(唯一依赖)     │  │   宿主侧扩展契约          │
   └──────────────┬───────────┘  └──────────────────────────┘
                  │
        插件(独立运行或独立进程)
包 角色 谁引用
Furion 插件运行时(大脑),随宿主进程运行,不可卸载 宿主
Furion.Abstractions 插件契约:接口、模型、选项、清单与错误码 宿主、插件作者
Furion.Hosting 宿主侧扩展契约:管理面、受管重启、包签名与观测 宿主扩展、管理面

默认路由:

  • 宿主端点与静态资源继续走宿主原有路由;
  • 普通插件端点在 /{RoutePrefix}/{pluginId} 下,默认前缀为 /furion;
  • 管理槽插件挂在 /furion,根前端槽插件挂在宿主根 /,两个全局槽各只允许一个活跃占位。

环境要求

  • .NET 11 SDK(global.json 固定 11.0.100)
  • 可选:Node.js 24.21.0 + pnpm 11.22.0,仅构建管理控制台前端时需要

快速开始

1. 运行样例宿主

git clone https://gitee.com/dotnetchina/Furion.git
cd Furion

dotnet run --project backend/samples/Furion.Samples.Host

样例宿主默认监听 http://127.0.0.1:5120。开发环境会自动发现并加载仓库里的源码插件,样例插件启动后即可访问:

http://127.0.0.1:5120/furion/plugin-demo/Demo/hello

返回 hello from plugin-demo 说明宿主编译、插件发现与接口调用链路都已正常。

2. 打开管理控制台

管理控制台由官方插件 furion-sandbox 提供,首次使用需要先构建前端:

cd frontend/sandbox
pnpm install
pnpm build
pnpm deploy:wwwroot
cd ../..

dotnet run --project backend/samples/Furion.Samples.Host

浏览器打开 http://127.0.0.1:5120/furion。首次启动会播种管理员,用户名与随机初始口令写入插件数据目录的 initial-admin.json(启动横幅会打印路径),登录成功后文件被删除;生产环境不会自动建号。

生产首次部署时,管理控制台与身份插件必须随宿主分发,或预先放入宿主程序目录下的 furion-bundled/。不能等管理面起来后再用命令行工具安装,因为那时管理面端点还不存在。

3. 接入自己的宿主

安装 NuGet 包:

dotnet add package Furion

从源码使用时,在宿主工程中直接引用运行时工程:

<ItemGroup>
  
  <ProjectReference Include="..\furion\backend\framework\Furion\Furion.csproj" />
</ItemGroup>

然后在 Program.cs 中加两行:

using Furion;

var builder = WebApplication.CreateBuilder(args);
builder.AddFurion();

var app = builder.Build();
app.UseFurion();
app.Run();

也可以一行启动:FurionApp.Run();。

4. 写第一个插件

插件只引用 Furion.Abstractions,不要引用 Furion 运行时。一个最小插件由工程文件、清单、入口和控制器组成:工程目标是 net11.0,引用契约包,并把 furion-plugin.json 设为随程序集复制到输出目录。

furion-plugin.json:

{
  "$schema": "https://furion.net/schemas/furion-plugin.schema.json",
  "id": "hello-plugin",
  "name": "示例插件",
  "version": "1.0.0",
  "entry": "HelloPlugin.dll"
}

入口实现 IFurionPlugin:

using Furion.Plugins.Registry;
using Furion.Plugins.Scope;

namespace HelloPlugin;

public sealed class Plugin : IFurionPlugin
{
    public Task StartAsync(IFurionPluginContext context, CancellationToken cancellationToken = default)
        => Task.CompletedTask;

    public Task StopAsync(IFurionPluginContext context, CancellationToken cancellationToken = default)
        => Task.CompletedTask;
}

控制器直接按原生 ASP.NET Core 写法,路由会自动收进插件前缀:

using Microsoft.AspNetCore.Mvc;

namespace HelloPlugin.Controllers;

[ApiController]
[Route("[controller]")]
public sealed class HelloController : ControllerBase
{
    [HttpGet("hello")]
    public string Hello() => "hello from hello-plugin";
}

开发期把插件输出目录交给样例宿主即可直接加载,不需要打包:

$env:FURION_DEVELOPER_PLUGINS = "C:\work\HelloPlugin\bin\Debug\net11.0"
dotnet run --project backend/samples/Furion.Samples.Host

然后访问 http://127.0.0.1:5120/furion/hello-plugin/Hello/hello。

对外分发时用 furion 命令行工具打包:

dotnet build -c Release
furion pack -s bin/Release/net11.0 -o hello-plugin.fpkg

furion 来自 Furion.Tool 包(源码在 backend/tools/Furion.Tool),可执行 dotnet tool install -g Furion.Tool 安装。

插件形态

形态 清单关键字段 运行方式
运行时入口型 shape: "inProcess"(默认)+ entry 从插件包加载并激活,可包含控制器、声明式端点、中间件、后台服务与事件
纯前端型 shape: "frontend" + frontend 没有后端程序集,静态资源挂 /{RoutePrefix}/{pluginId},安装即激活
根前端型 shape: "frontend" + mountAt: "root" + frontend 静态资源挂宿主根 /,全局至多一个活跃占位
进程型 shape: "process" + process.command 由独立子进程运行,宿主把请求转发给它,适合进程级隔离或其他语言实现

命令行

统一命令行工具 furion(包名 Furion.Tool):

命令 作用
furion new 用模板生成插件工程
furion pack 把插件输出目录打成 .fpkg,可加作者签名
furion schema 导出插件清单的结构定义
furion install 安装 .fpkg 到运行中的宿主
furion upgrade 升级已安装插件
furion enable / disable 启用或停用已安装插件
furion reload 热重载已启用插件
furion uninstall 卸载插件,默认保留数据目录
furion diagnose 诊断插件卸载后的残留
furion restart 请求宿主受管重启,完成待重启清理

面向运行中宿主的命令需要管理面访问令牌;所有子命令支持 --json 单行输出,便于脚本集成。

官方插件

官方插件是普通插件,按需安装:

  • furion-identity:账号与口令、访问令牌与刷新轮换、锁定、权限目录与安全审计。登录 POST /furion/auth/furion-identity/login,当前用户 GET /furion/auth/me。
  • furion-sandbox:管理控制台与插件管理面,声明 mountAt: "admin",界面挂在 /furion,提供插件装卸、运行时配置、宿主健康与可观测端点。

源码位于 backend/plugins/Furion.Identity 与 backend/plugins/Furion.Sandbox。

文档与社区

欢迎通过问题反馈与代码贡献参与 Furion。

版本

当前版本:6.0。

提醒:6.0 当前为预览版,正式版发布前公开接口可能调整。

许可证

Furion 6.0 采用 Mozilla Public License 2.0(MPL-2.0)。版权归百小僧及百签科技(广东)有限公司所有。

你可以自由使用、修改与分发本软件,包括用于商业用途;修改过的 MPL 覆盖文件需继续以 MPL-2.0 公开源码,新增文件与更大作品可以采用其他许可。分发时请保留 LICENSE 与版权声明。

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Furion.Hosting:

Package Downloads
Furion

Furion 运行时:让 ASP.NET Core 应用以插件方式安装、启停、升级与卸载功能。

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
6.0.0-preview.3 0 11/30/2026
6.0.0-preview.2 40 11/29/2026