I would like to share a project i have been working with for a long time, it gives you a MVC like developer experience on Netduino.
To initialize the server:
public class Program { public static void Main() { var webServer = new WebServer(); webServer.Start(80); } }
To create your first controller:
public class MyFirstController : Controller { public void Index() { SetHtmlResult("<!DOCTYPE html><html><body><h1>My page</h1></html>"); } }
Then run http://192.168.1.100/MyFirst or similar.
The main features is:
- Controller/Action based web request routing with model binding and HTML or JSON response types built in.
- It support both GET and POST http methods.
- Exception handling with generic error response that includes exception message and stack trace.
- It support static files via an optional assembly(to save code space if not needed).
- Filters on request and response for things like logging, authentication and other things.
It is built with Dependency injection and has some Unit tests.
For source code with running examples and some more decumentation see
https://github.com/Rinsen/WebServer
And for long running scenarios i really recommend adding some kind of hardware based watch guard.