How to run .NET applications on Linux

How to run .NET applications on Linux

Summary: In many enterprise environments we work with a mix of Windows and Linux servers. If you had to build a large, complex enterprise application that runs on Linux, you would typically use Java.

SHARE:

In many enterprise environments we work with a mix of Windows and Linux servers. If you had to build a large, complex enterprise application that runs on Linux, you would typically use Java. Now there's an alternative that's maturing and gaining popularity--you can run .NET applications on Linux, using the open source Mono runtime.

Running .NET applications with Mono on Linux is surprisingly easy. You use Visual Studio 2008 on your Windows PC to build your .NET console application and compile it into an .exe file. Copy the .exe file (say ConsoleApplication1.exe) to the Linux server and run it with the command:

mono ConsoleApplication1.exe

And that's it--Mono will run your .NET binaries without requiring any conversion. Mono supports ASP.NET and WinForm applications too, but be prepared to spend a bit more effort to get them running on Mono.

Installing Mono on your Linux server is easy. If you have EPEL configured on your Linux server, you can run this command to install the Mono runtime:

yum install mono-core

Here's a helpful tip: Mono doesn't trust any root certificates by default, so if your application uses SSL it may fail. You can fix this problem with the command:

mozroots --import

Topics: Servers, Microsoft, Software Development

Lee Lup Yuen

About Lee Lup Yuen

Lee Lup Yuen is passionate about mobile phones and PDAs, as he is constantly buying new gadgets and programming them in J2ME, .NET, Symbian and AppForge.
He has developed commercial applications with mobile technologies like SMS, MMS, WAP, 3G video streaming and location-based services.

Kick off your day with ZDNet's daily email newsletter. It's the freshest tech news and opinion, served hot. Get it.

Talkback

2 comments
Log in or register to join the discussion
  • How to run .NET applications on Linux

    I read lot about the performance issues running .net binary files using Mono on Linux compared to on Windows. What is your opinion and have you done any performance test with some real data.

    Thanks,
    - DM
    anonymous
  • Our customers at http://www.rokabear.com have reported using this with good success. It does appear there is a bit of a slow down, but unless you are under heavy loads you shouldn't notice it. However, some of them have just decided to run faster dedicated servers rather than rewrite their code.

    Good Luck
    Techhead
    Techhead-adf96