CCSWE.nanoFramework.WebServer
1.1.122
dotnet add package CCSWE.nanoFramework.WebServer --version 1.1.122
NuGet\Install-Package CCSWE.nanoFramework.WebServer -Version 1.1.122
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="CCSWE.nanoFramework.WebServer" Version="1.1.122" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CCSWE.nanoFramework.WebServer" Version="1.1.122" />
<PackageReference Include="CCSWE.nanoFramework.WebServer" />
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 CCSWE.nanoFramework.WebServer --version 1.1.122
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CCSWE.nanoFramework.WebServer, 1.1.122"
#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 CCSWE.nanoFramework.WebServer@1.1.122
#: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=CCSWE.nanoFramework.WebServer&version=1.1.122
#tool nuget:?package=CCSWE.nanoFramework.WebServer&version=1.1.122
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CCSWE.nanoFramework.WebServer
A simple asynchronous web server for nanoFramework modelled after ASP.NET Core. See the WebServer sample for a complete example.
Features
- Attribute-based controllers with routing and parameter binding
- Custom middleware via
IMiddleware - Request thread pool for concurrent request processing
- Pluggable authentication via
IAuthenticationProvider - HTTPS support
Quick Start
Controller
[Route("api/status")]
public class StatusController : ControllerBase
{
[HttpGet]
public void Get()
{
Ok("running");
}
}
Middleware
public class LoggingMiddleware : IMiddleware
{
public void Invoke(HttpListenerContext context, MiddlewareDelegate next)
{
// pre-processing
next(context);
// post-processing
}
}
DI Registration
Register controllers individually or let reflection discover all controllers in an assembly:
services.AddWebServer(options =>
{
options.Port = 80;
})
.AddMiddleware(typeof(LoggingMiddleware))
.AddController(typeof(StatusController)); // register one controller explicitly
AddControllers uses reflection to scan an assembly and automatically register every class that derives from ControllerBase, eliminating the need to list them individually:
services.AddWebServer(options =>
{
options.Port = 80;
})
.AddMiddleware(typeof(LoggingMiddleware))
.AddControllers(); // scans the executing assembly
// or target a specific assembly:
.AddControllers(Assembly.GetExecutingAssembly());
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NETnanoFramework | netnano1.0 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETnanoFramework 1.0
- CCSWE.nanoFramework.Core (>= 1.1.122)
- CCSWE.nanoFramework.Threading (>= 1.1.122)
- nanoFramework.CoreLibrary (>= 1.17.11)
- nanoFramework.DependencyInjection (>= 1.1.32)
- nanoFramework.Json (>= 2.2.203)
- nanoFramework.Logging (>= 1.1.161)
- nanoFramework.Runtime.Events (>= 1.11.32)
- nanoFramework.System.Collections (>= 1.5.67)
- nanoFramework.System.IO.Streams (>= 1.1.96)
- nanoFramework.System.Net (>= 1.11.50)
- nanoFramework.System.Net.Http (>= 1.5.203)
- nanoFramework.System.Text (>= 1.3.42)
- nanoFramework.System.Threading (>= 1.1.52)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.