Hello forums, I am probably missing something simple, but I’m finding myself in an odd place. I’ve been having fun with the Mono v2 Runtime over the past few weeks, and started rewriting a couple of my own projects that I formerly began writing in Lua. One of the first things I went to work on was the webserver portion of the resource, but I had trouble getting the SetHttpHandler native to do anything useful. I don’t think it does anything at all, because even after being called, the resource route always returns “Not found.” similar to other resources that do not set a handler. I was hoping there were some working examples somewhere to prove that this is indeed possible, however a quick search on GitHub didn’t give me much to work with.
For clarity, this is what I’m currently working with:
public class WebserverMain : BaseScript
{
private void RegisterWebHandler()
{
Debug.WriteLine("SetHttpHandler");
Natives.SetHttpHandler(new Action<dynamic, dynamic>(async (req, res) => {
Debug.WriteLine($"Request received from: {req.address}");
}));
}
}
When the resource is started, I get a “SetHttpHandler” log but never any “Request received from…” logs when making a request to /my-resource-name.
Any help or clarity is greatly appreciated
I looked in many places to see if anyone else also ran into this problem.





