Run .NET applications on Linux

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

Leave a Reply

Your email address will not be published. Required fields are marked *