Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running ASP.Net on a Linux based server

People also ask

Can I host ASP net on Linux server?

ASP.NET can run on both Windows servers and Linux servers. So, don&'t feel confined to a Windows host, although Windows hosting services will be optimized for ASP.NET websites and applications. Your host will need an SQL server database, such as MySQL, to be able to host applications built using ASP.NET.

Can you run ASP NET on Linux?

Given that . NET Core, as a runtime, is a both open source and multiplatform it's easy to understand the desire to run your ASP.NET Core project on a Linux host. Practically always you can find a Linux webhost cheaper than a Windows webserver.


So I know this is an older question but I think it could stand an updated answer.

Microsoft has officially released asp.net vnext and its open source and deploy-able to both Linux and Mac. Its all still pretty new but does rely on the latest builds of mono and thus currently needs you to compile the mono-framework but in time I suspect that it will be easier to access as various linux distros release updated versions of mono. This is a how to setup guide

This information may be somewhat volatile and with updates is due to change.

Update ASP.NET CORE 11/10/2017

  • asp.net vnext is now known as asp.net core.
  • asp.net core is being treated as a high priority in Microsoft due in part to its use with microservice architecture and docker and container technologies
  • It has become much more compatible with existing .net libraries due to .net standard 2.0.
  • It performs well when compared to other technology stacks such as go and node.js

It depends what specific .NET technologies you're using. The Mono Project provides an Apache module (mod_mono) for running ASP.NET sites, and from what I gather it works well.

Mono doesn't support all the .NET APIs, though - notably WPF (and possibly WCF too, I can't remember) - but it does provide good support for much else of the framework.

If you're starting from scratch and particularly want to target non-Windows servers, then ensuring your project works with Mono would be a good goal to aim for. However, if you need particular APIs or language features that are not supported by Mono, then you will need to use a Windows server for deployment. It's a design-time/architectural choice that should make up front.


You might want to consider this guide that helps Windows developers port their code to Mono/Linux:

Guide: Porting ASP.NET Applications - Mono


I can speak from experience. Even if your ASP.net website only uses .NET libraries supported by Mono you are going to have a hard time getting it to run if its anything beyond Hello World.

You won't have to re-write much code but you will spend hours/days/weeks dealing with little issues with mod_mono/xsp/apache configuration and file permissions and error handling and all the little things that go into a large website. (Be prepared to spend a lot of time asking questions on serverfault :) )

The problem is that a lot of people don't use Mono for ASP.net websites and so there aren't as many people reporting bugs so a lot of things that are minor bugs go un-fixed for a long time.