MicroServer 1.5.2
dotnet add package MicroServer --version 1.5.2
NuGet\Install-Package MicroServer -Version 1.5.2
<PackageReference Include="MicroServer" Version="1.5.2" />
<PackageVersion Include="MicroServer" Version="1.5.2" />
<PackageReference Include="MicroServer" />
paket add MicroServer --version 1.5.2
#r "nuget: MicroServer, 1.5.2"
#:package MicroServer@1.5.2
#addin nuget:?package=MicroServer&version=1.5.2
#tool nuget:?package=MicroServer&version=1.5.2
🛠️ MicroServer是什么?
MicroServer 是一款 .NET 生态的 轻量级 Web 请求胶水库,主打 “集成至上、灵活嵌入”,哪里需要 Web 能力,就粘哪里。
它无需依赖 IIS、Kestrel 这类传统 Web 服务器,可直接嵌入任意 .NET 应用快速搭建 Web API;开箱即用零配置,无需修改原有业务代码,无论是轻量级 Web API、WebSocket 实时通信、边缘计算 Web 服务,还是轻量流媒体服务器,用它都恰到好处。
📦 极小体积:单 DLL 仅 50kb,无第三方依赖,极致轻量
💡 极简上手:NuGet 安装 MicroServer ,再添加一个路由即可完成 Web API 搭建
🔗 灵活兼容:胶水特性完美配合其他库,老旧项目无需改动业务代码
🛡️ 开箱即用:内置默认路由、简单 Token 验证、JWT 验证,覆盖大多数基础场景
🚀 极速运行:全异步非阻塞架构,原生支持 AOT 编译,毫秒级启动,轻松应对各类网关
🌍 跨平台兼容:基于 .NET Standard 2.0 开发,支持 .NET Framework/Core/5/6+ 以及 Linux、Windows、macOS
✨ 高度可扩展:通过自定义 AddRoute(路由)与 AddMiddleware(中间件),轻松实现二次开发,解锁更多进阶功能
快速入门如下。更多使用方式请查看 MicroServer官方文档
🛠️ What is MicroServer?
MicroServer is a lightweight web request glue library deeply rooted in the .NET ecosystem. It focuses on "Integration-First, Flexible Embedding" — embed it wherever you need web capabilities.
It runs independently of traditional web servers like IIS or Kestrel, and can be directly embedded into any .NET application to quickly build web APIs. It works out of the box with zero configuration and requires no modifications to your existing business code. Whether you need a lightweight Web API, WebSocket real-time communication, edge computing web services, or a lightweight streaming media server, MicroServer fits perfectly.
📦 Ultra-Small Footprint: The single DLL is only 50kb with no third-party dependencies, achieving ultimate lightweight design.
💡 Extremely Easy to Get Started: Install MicroServer via NuGet, then add just one route to complete your Web API setup.
🔗 Flexible Compatibility: Its glue-like nature integrates seamlessly with other libraries — no need to alter business code in legacy projects.
🛡️ Out-of-the-Box Ready: Built-in default routing, simple Token authentication, and JWT authentication cover most basic scenarios.
🚀 Blazing Fast Performance: Features a fully asynchronous non-blocking architecture, natively supports AOT compilation, boots up in milliseconds, and handles all kinds of gateways with ease.
🌍 Cross-Platform Compatibility: Developed based on .NET Standard 2.0, it supports .NET Framework/Core/5/6+ as well as Linux, Windows, and macOS.
✨ Highly Extensible: Customize AddRoute (Routing) and AddMiddleware (Middleware) to easily implement secondary development and unlock more advanced features.
For more usage methods, please refer to the MicroServer Official Documentation.
C#示例(C# example)
using System.Net;
using MicroServer;
namespace FastTestNamespace
{
public static class FastTest
{
private static readonly WebAPIServer MyAPI = new WebAPIServer();
public static void Main()
{
MyAPI.AddRoute("/", Hello);// 添加路由映射,
MyAPI.StartServer(); // 启动服务(默认8090端口)传入参数可修改端口
Console.WriteLine("访问地址:http://127.0.0.1:8090");
Console.ReadKey();
}
// 异步处理方法
private static async Task Hello(HttpListenerRequest request, HttpListenerResponse response)
{
await response.WriteAsync("""{"code":1,"msg":"Hello WebAPI"}""");
}
}
}
VB.NET示例(VB.NET example)
Imports System.Net
Imports MicroServer
Module FastTest
Private ReadOnly MyAPI As New WebAPIServer
Sub Main()
MyAPI.AddRoute("/", AddressOf hello) '添加路由映射
MyAPI.StartServer() '启动 WebAPI 服务,默认端口8090 传入参数可修改端口
Console.WriteLine("访问地址:http://127.0.0.1:8090")
Console.ReadKey()
End Sub
Private Async Function hello(request As HttpListenerRequest, response As HttpListenerResponse) As Task
Await response.WriteAsync(<t>{"code":1,"msg":"Hello WebAPI"}</t>.Value)
End Function
End Module
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.