Standalone async web API on Mono

Has anybody had success (production code) with hosting a standalone async web API (asp.net web API) based service on Mono? By standalone I mean hosting the API in a console app outside of asp.net.

I am looking for a simple way to create a REST API and I would really really like to make my stack async (C#5 style) from the top HTTP layer to the bottom data access layer, now that C#5 has such good support for it.

Normally I would go with ServiceStack and host this as a daemon on Linux, but because ServiceStack does not support the new C#5 async stuff in their services (as far as I know), I am considering using a self-hosted async web API on Mono.

I know that there is some async branch on the way in ServiceStack, but it is not ready, and I know that there are some asynconeway things in ServiceStack, but I don't think this is using the new task based async stuff in C#5.

So my question is whether it is possible and stable enough to make a REST service using a self-hosted async web API on mono, or if it is better just to use synchronous ServiceStack when doing standalone hosting on Mono?


Better use async NancyFx. Web API is not well supported on Mono (yet). With Nancy, you would do like:

public Module()
{
    Get["/greet/{name}"] = async x => {
        await Task.Delay(5000);
        return string.Concat("Hello ", x.name);
    };
}

不完全是独立的应用程序,但请查看本教程关于在Linux和OS X下运行ASP.NET Web API服务的内容它显示了如何从基于UNIX的操作系统运行ASP.net Web API。

链接地址: http://www.djcxy.com/p/20518.html

上一篇: MVC 5项目和Web Api项目的区别

下一篇: Mono上的独立异步Web API