Complete documentation for the self-hosted .NET micro-framework
← Back to Main SiteCreate your first self-hosted web server in minutes
using Netiqo.Framework;
var host = new Host("127.0.0.1", 8080);
host.LogMessage += Console.WriteLine;
host.RegisterRoute(new Route("/", Request.HttpMethod.GET,
htmlResponse: "<h1>Homepage</h1>"));
await host.StartAsync();
Main components and API for development
Main class for web server management with optional HTTPS support.
public Host(string ip, int port, string certPath = null, string certPassword = null)
Route definition with support for dynamic handlers or static HTML responses.
public Route(string path, Request.HttpMethod method,
Func<string, Task<string>> handler = null,
string htmlResponse = null)
Decorator for defining routes directly on methods of controller classes.
[Route("/api/test", Request.HttpMethod.GET)]
public string Test(string body) => "<h1>Test</h1>";
Full support for all standard HTTP methods:
Utility to obtain network information and default configurations.
string ip = Device.Ipv4();
int defaultPort = Device.DefaultPort; // 8080
Maximum flexibility in route definition
Perfect for informational pages or content that does not change frequently.
host.RegisterRoute(new Route("/about", Request.HttpMethod.GET,
htmlResponse: "<h1>About Us</h1>"));
For content that requires server-side processing and interaction with data.
host.RegisterRoute(new Route("/login", Request.HttpMethod.POST, async body =>
{
var parsed = HttpUtility.ParseQueryString(body);
return $"<h1>Welcome {parsed["username"]}</h1>";
}));
Load routes from external JSON files for more flexible management.
[
{
"Path": "/hello",
"Method": "GET",
"HtmlResponse": "<h1>Hello from JSON</h1>"
}
]
Secure connections with SSL/TLS certificates
Easily configure secure connections using PFX certificates for production environments.
var host = new Host("127.0.0.1", 443,
"certificates/mysite.pfx", "mypassword");
Automatic service of static resources
The files in the wwwroot/
are automatically served by the server, allowing you to distribute CSS, JavaScript, images and other assets needed by your application.
📁 Project/
├── 📁 wwwroot/
│ ├── 📁 css/
│ │ └── styles.css
│ ├── 📁 js/
│ │ └── app.js
│ └── 📁 images/
│ └── logo.png
└── Program.cs
Flexible and customizable logging system
Flexible logging system to intercept and manage all server events.
host.LogMessage += msg => Console.WriteLine("[LOG] " + msg);
// Advanced logging with timestamps
host.LogMessage += msg => {
var timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Console.WriteLine($"[{timestamp}] {msg}");
};
Versatile for all kinds of applications
Integrate web servers directly into your desktop or IoT applications
Create APIs and services accessible from the local network without complex configurations
Develops lightweight microservices for distributed architectures