37

Are there any frameworks that allow a RESTful API Server to be written in C#?

I have seen MVC 4, however this seems to be providing a view that you can see in the browser, I just require the API server and no view. It would be great if it was able to provide a streaming API too.

Thanks

0

6 Answers 6

30

If you are using .NET Framework 4.5 you can use Web API

If you are using .NET Framework 3.5 I highly recommend ServiceStack

If you are using .NET Core then you can use ASP.NET Core Web API

2
  • Thank you for your answer. How would I set up my project to use Web API without having to use a view engine?
    – BytesGuy
    Commented May 25, 2013 at 17:31
  • 3
    I don't think that web api is depending on Razor view engine and it an API only Commented May 25, 2013 at 17:33
17

Nancy is a free REST framework for C#.

1
  • Unfortunately, no longer maintained.
    – doo_dah
    Commented Nov 4, 2022 at 15:35
3

If you are working in .NET 4.0 or higher and looking for a pre-existing REST server solution that you can plug into (which it sounds like you are), you might want to check out Grapevine. You can get it using NuGet, and the project wiki has lots of sample code.

I am the project author, and I had a similar need as the one you described. Using resources I found here and elsewhere, I built Grapevine so that I would have a solution in my back pocket whenever I needed it again (DRY).

3

If you are ok with using IIS to host your app, WebAPI is the route to go, per the above answers. Not every solution is best in IIS however.

For executable apps (such as a windows service), consider using WebServicesHost. This page is a good example of how to implement it.

2

2022, no IIS/ASP answer:

Consider EmbedIO (and probably SWAN on top of that)

A tiny, cross-platform, module based, MIT-licensed web server for .NET Framework and .NET Core.

0

You can use web api, it is part of the .net MVC framework but it is relying on the razor engine (inly if you use the mvc templating engine cshtml).

If you are using .net 4.0 you can use web api 1, If you are you .net 4.5 you can use web api 2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.