Running ASP.Net on a Linux based server

asp.netLinuxMono

asp.net Problem Overview


For a developer with a Java background, I am interested in exploring software development using the ASP.NET tools/platform as well.

Java web applications (.jsp and servlets) can run on many server platforms.

Question: Will a .NET web application be able to run in a Linux based server? Considering the scenario of not being able to use a Windows server for hosting a web app.

asp.net Solutions


Solution 1 - asp.net

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

Microsoft has officially released http://blogs.msdn.com/b/dotnet/archive/2014/05/12/the-next-generation-of-net-asp-net-vnext.aspx">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. http://graemechristie.github.io/graemechristie/blog/2014/05/26/asp-dot-net-vnext-on-osx-and-linux/">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

Solution 2 - asp.net

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.

Solution 3 - asp.net

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

Guide: Porting ASP.NET Applications - Mono

Solution 4 - asp.net

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.

Solution 5 - asp.net

Now you can publish ASP.NET 5 app to Docker on Linux with Visual Studio. See the below post from Scott Haselman

http://www.hanselman.com/blog/PublishingAnASPNET5AppToDockerOnLinuxWithVisualStudio.aspx

Solution 6 - asp.net

Since the technologies evolve and this question is top ranked in google, we need to include beyond the mono the new asp.net core, which is a complete rewrite of the asp.net to run for production in Linux and Windows and for development for Linux, Windows and Mac:

> You can develop and run your ASP.NET Core apps cross-platform on > Windows, Mac and Linux. ASP.NET Core is open source at GitHub.

Solution 7 - asp.net

Yes we can. get familiar with Mono Project and read this article to get started.

Solution 8 - asp.net

For ASP.NET on Linux, check out Mono.

That said, thousands of sites run on Windows Server without any issues. A poorly-configured server with any OS will be vulnerable; Linux won't save you from a poor admin.

So I guess my "best practice" for deplying an ASP.NET app would be to use Windows Server 2008 (likely Web edition). And hire a good administrator.

Solution 9 - asp.net

You can use Mono to run ASP.NET applications on Apache/Linux, however it has a limited subset of what you can do under Windows. As for "they" saying Windows is more vulnerable to attack - it's not true. IIS has had less security problems over the last couple of years that Apache, but in either case it's all down to the administration of the boxes - both OSes can be easily secured. These days the attack points are not the OS or web server software, but the applications themselves.

Solution 10 - asp.net

dotnet is the official home of .NET on GitHub. It's a great starting point to find many .NET OSS projects from Microsoft and the community, including many that are part of the .NET Foundation.

This may be a great start to support Linux.

Solution 11 - asp.net

Now a days .Net is run in multiple platforms,like linux ,Mac os etc. but mono is not fully platform independent ,Because to deploy .NET in another OS required third party software.so it is not like java platform independent.

Mono is running in different platform ,because of JIT is there in different os.

Mono is not fully success in moonlight(silver light in .NET) .Not only Research is going on.

Mono uses XSP2 server or apache . some of the big companies are using this project,Some of the robotic project are also running on mono.

For more details http://www.mono-project.com/Main_Page.

Solution 12 - asp.net

There is the Mono Project from Novell that will allow you to run ASP.Net on Apache.

http://www.mono-project.com/Main_Page

Solution 13 - asp.net

The Mono project is your best option. However, it has a lot of pitfalls (like incomplete API support in some areas), and it's legally gray (people like Richard Stallman have derided the use of Mono because of the possibility of Microsoft coming down on Mono by using its patent rights, but that's another story).

Anyway, Apache supports .NET/Mono through a module, but the last time I checked the version supplied with Debian, it gave Perl language support only; I can't say if it's changed since, perhaps someone else can correct me there.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAnandView Question on Stackoverflow
Solution 1 - asp.netTerranceView Answer on Stackoverflow
Solution 2 - asp.netalastairsView Answer on Stackoverflow
Solution 3 - asp.netmiguel.de.icazaView Answer on Stackoverflow
Solution 4 - asp.netthelsdjView Answer on Stackoverflow
Solution 5 - asp.netTepuView Answer on Stackoverflow
Solution 6 - asp.netmqueirozcorreiaView Answer on Stackoverflow
Solution 7 - asp.netddeView Answer on Stackoverflow
Solution 8 - asp.netdahlbykView Answer on Stackoverflow
Solution 9 - asp.netblowdartView Answer on Stackoverflow
Solution 10 - asp.netKurkulaView Answer on Stackoverflow
Solution 11 - asp.netanishMarokeyView Answer on Stackoverflow
Solution 12 - asp.netJaredView Answer on Stackoverflow
Solution 13 - asp.netBenView Answer on Stackoverflow