Settings

Theme

Running ASP.NET Web API Services under Linux and OS X

piotrwalat.net

25 points by zaidos 13 years ago · 16 comments

Reader

socialist_coder 13 years ago

I just got our production server for our new mobile game setup on AWS EC2 running a similar setup- Ubuntu, Mono, and Nginx. I wanted to use C# server side so I could share code with the client (a game written in C# + Unity3d).

It was pretty easy to get up and running, even without running Visual Studio (I used Xamarin Studio (Monodevelop) for everything). I think it was a lot easier to get setup than this blog post makes it seem. I installed everything via apt-get and only touched 2 or 3 config files in total.

The most confusing thing for me was what kind of ASP.NET project to create. I've never done any .NET web development before so the differences between a "Web Application", "MVC 2" and "MVC 3" project were not clear.

I haven't done any load testing yet but I'm hoping it is stable and can handle all our meager load on a single EC2 instance. I'm also running DynamoDb and Redshift for a full AWS stack.

After finally wrapping my head around ASP.NET MVC I think it has a lot more of a learning curve than a Python/Django type web app (my only other serious exposure to web apps). The way Django does routing, URL variables, and responses seems a lot more intuitive.

  • PallarelCoedr 13 years ago

    Asp.Net Empty Web Application is the base project for an IIS hosted... asp.net app. It just contains the bare minimum web.config and project settings to get started. Though there are too many project references imho. All asp.net projects are based off this.

    Asp.Net Web Forms Application is the original, and now derided, web framework. Consider it deprecated.

    Asp.Net MVC Web Application is comparable to Rails / Django and the current version is 4.

    The alternative to MS's MVC framework is FubuMVC [0] and is well respected.

    Another alternative and is far more lightweight is NancyFX [1], .net's equivalent to ruby's sinatra [2].

    [0] http://mvc.fubu-project.org/

    [1] http://nancyfx.org/

    [2] http://www.sinatrarb.com/

    • pjmlp 13 years ago

      > Asp.Net Web Forms Application is the original, and now derided, web framework. Consider it deprecated.

      I wish it was so in the enterprise world.

    • socialist_coder 13 years ago

      NancyFx seems exactly what I was looking for. I only checked out ServiceStack but it seemed as equally complex as the Asp.Net stuff. Thanks a bunch.

    • taude 13 years ago

      Don't forget to add Service Stack to this list: http://servicestack.net/

      • PallarelCoedr 13 years ago

        That's more geared towards web services, i.e. a WCF replacement (even though it supports razor view engine). Mentioned it in a comment below anyway :)

  • ak0s 13 years ago

    Are you using default garbage collector, or switched to SGen? http://www.mono-project.com/Generational_GC

    You may have memory usage problems http://stackoverflow.com/a/8766427/55209

    • socialist_coder 13 years ago

      Thanks a lot for bringing this up. After load testing a whole bunch today I was definitely seeing unexpected memory usage and unbounded growth.

      I also ported my app to Nancy and load tested it as well. The performance was about the same and the memory usage grew as well but it seemed to eventually stop growing.

      After reading a lot and trying (unsuccessfully) to make fastcgi-mono-server4 use mono-sgen I just gave up and went the console app self hosting route (using Nancy).

      With self hosting my memory stays ultra low and doesn't grow. It also sped up the app quite significantly. My previous benchmarks were 10,000 requests served in 35-45 seconds (using fastcgi-mono-server4) and now I'm seeing 16-18 seconds (self hosting).

      So yeah, self hosting is the way to go it seems.

Yuioup 13 years ago

It's sounds cool and all but would you run this in a production environment? I am a ASP.NET developer by day and Linux fan at night, but there is no way I can convince anyone run ASP.NET applications on Linux.

I don't think you can reliably run ASP.NET applications on Linux. Or am I mistaken?

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection