insanelab.com insanelab.com

August 24, 2018 - Dotnet Software Development

.NET Core on Linux. A New Way to Save Money

The .NET Core is relatively young. Especially when compared to over 16 years of .NET Framework’s history. And that’s why some developers still don’t get every aspect of them right. Let’s sort it out.

.NET Framework has become one of the most popular choiceswhen it comes to developing reliable, fast, and scalable web applications. But separate maintenance of .NET platforms without a systematic approach resulted in fragmentation. It’s not so easy to use the framework to create cross-platform apps.

That’s why .NET Core has been released. It’s an open-source, multiplatform version of .NET framework that is supposed to maximize code sharing and reuse. Lately, it also became a wise choice for startups and any other young companies.

But how do these two differ exactly?

.NET Core vs .NET Framework

  • Cross-platform use

When the goal is to run your application on multiple platforms—Windows, MacOS, or Linux, the go-to is .NET Core—thanks to runtime (CoreCLR) and libraries being cross-platform. Its open source character is definitely an advantage but what’s more, Microsoft is investing in it heavily. It means .NET Core will keep being developed and maintained.

For developers, it’s best to use .NET Core on Windows as there’s the Visual Studio IDE available. It supports many productivity features like project management, debugging, source control, refactoring, rich editing with Intellisense, testing, and more.

But the cross-platform character of .NET Core allows using it also on Mac or Linux on Visual Studio Code. This software also includes IntelliSense and debugging.

  • Microservices

Building microservices with .NET Core enables you to use different technologies, frameworks, or languages at microservice level. This way, you will create fast and scalable microservices as you can use the best approach and technology for every micro area in your system.

In this case, it is also possible to use .NET Framework that is not compatible with .NET Core to build a microservice. You might still need, however, to switch to .NET Core when thinking about scaling up.

  • Performance and scalability

If you expect that your system will need to scale and give the best possible performance with high numbers of users, .NET Core and ASP.NET Core is simply what you should be using. You can do quite a lot with the same amount of infrastructure or hardware, creating a rich experience for your end users. At lower costs.

Even if you don’t really think about scalability now, making sure the system is agile and capable of running high traffic volumes at scale is a way to reduce costs in the long run. That’s why .NET Core is becoming more and more popular.

  • Command line development

Some developers prefer to develop with simple editors and use command line more. .NET Core is designed for CLIbut this approach is optional. What’s worth mentioning is that the command line tools are available on all supported platforms—Windows, Mac, and Linux.

Building and testing applications with the installs on a developer, lab, or production machines kept at a minimum level are possible now. You can also choose the level of interacting with the toolchain—from CLI to editor and IDE.

The Limits of .NET Core

When reading about the advantages of using .NET Core, you might think that .NET Framework is no longer needed. But .NET Core hasn’t replaced it. What’s the difference, then?

.NET Framework is still a good choice for many existing applications. Mostly, you don’t need to migrate them to .NET Core. Instead, a good practice is to use .NET Core as you extend an existing application. For example, you could be writing a new web service in ASP.NET Core while leaving other parts on .NET Framework.

But that’s just a ‘good practice’. And no support for third-party .NET libraries or NuGet packages can be a solid blocker. It’s not that painful – the libraries are shared quicker with .NET Standard as it allows to share code across all .NET implementations. Including .NET Core.

.NET Standard 2.0 introduced a much larger API surface along with a .NET Framework compatibility mode. It allows .NET Standard and .NET Core projects to reference .NET Framework libraries.

This means that the risk of being unable to use desired libraries and packages is low. But when you encounter a technology that isn’t available in the .NET Core—you’ll need to go with .NET Framework.

The most common technologies that can’t be found in .NET Core are:

  • ASP.NET Web Forms—and there are no plans to bring ASP.NET Web Forms to .NET Core.
  • ASP.NET Web Pages—but ASP.NET Core Razor Pages have many similarities.
  • WCF services implementation—it is currently only available in the .NET Framework. It’s not on the roadmap now but is considered to become available for .NET Core in the future.
  • Visual Basic and F# are currently supported in .NET Core, but not for all project types.

What Do You Need to Use .NET Core?

.NET Core prerequisites and dependencies are added automatically with the native install apps. All you have to do is to run the installation. But on what operating systems, distributions, and versions are these available?

  • Windows
    • Windows 7 SP1
    • Windows 8.1
    • Windows 10 Anniversary Update (version 1607) or later versions
    • Windows Server 2008 R2 SP1 (Full Server or Server Core)
    • Windows Server 2012 SP1 (Full Server or Server Core)
    • Windows Server 2012 R2 (Full Server or Server Core)
    • Windows Server 2016 or later versions (Full Server, Server Core, or Nano Server)
  • Mac
    • macOS 10.12 “Sierra” and later versions
  • Linux (.NET Core 2.1)
    • Red Hat Enterprise Linux 7, 6 – 64-bit (x86_64 or amd64)
    • CentOS 7 – 64-bit (x86_64 or amd64)
    • Oracle Linux 7 – 64-bit (x86_64 or amd64)
    • Fedora 28, 27 – 64-bit (x86_64 or amd64)
    • Debian 9 (64-bit, ARM32), 8.7 or later versions – 64-bit (x86_64 or amd64)
    • Ubuntu 18.04 (64-bit, ARM32), 16.04, 14.04 – 64-bit (x86_64 or amd64)
    • Linux Mint 18, 17 – 64-bit (x86_64 or amd64)
    • openSUSE 42.3 or later versions – 64-bit (x86_64 or amd64)
    • SUSE Enterprise Linux (SLES) 12 Service Pack 2 or later – 64-bit (x86_64 or amd64)
    • Alpine Linux 3.7 or later versions – 64-bit (x86_64 or amd64)

.NET Core on Linux

Okay, so why would you care about .NET Core on Linux? Well, this can be a big advantage for you.

As Linux is open-sourced, you can easily look into its code. This way, you can find any bugs and security vulnerabilities and fix them before they bring you any trouble. This also means it’s flexible—you can add almost any functionality you want, to tailor it to your needs.

For example, you could create your own Graphical User Interface to get rid of using terminal—if that’s what you need. You can use tools and utilities that are already there to enrich your server with a minimum effort.

It is also secure and—again—allows you to build your own security solutions. You could also use services like iptable firewall, TCP wrappers, and SELinux (Security Enhanced Linux). Actually, you can get SELinux by default in distributions like Fedora, Red Hat Enterprise Linux and some others.

One of the main advantages of Linux-based servers is their reliability. As Linux is based on Unix which was made to be, well, reliable, it is stable. But what differs it from Windows is that you can modify the system or program configuration without rebooting the server.

And if it all comes down to the money, Linux has got you covered. Although it won’t eliminate all maintenance and ownership costs, they are still lower, especially compared to Windows. Of course, there are some Linux distributions like RHEL or SUSE that require a monthly subscription to get premium services, but it’s up to you whether you choose it or not. Other distributions can be really cheap.

Most companies already maintain some Linux servers anyway. Buying a new Windows-operated server would be an additional cost for them. A cost that can be easily avoided by using .NET Core on the existing Linux infrastructure.

That’s why it’s such a good news to be able to run .NET Core on Linux!

The Future is Paved With Cloud-Computing Platform

Microsoft predicted that the future will be paved with cloud-computing platforms. That’s why now they develop tools to help those who will be willing to shape it. Some of their recent investments disclose this direction clearly—think about the Azure that runs on various OSes or the acquisition of Xamarin. Think about the .NET Core.

With this new platform, creating performant and scalable web applications, microservices, and console applications has never been so close to such a wide group of developers. And that can only mean one thing – faster development of better services.

Want to learn more?

What is your challenge?

Tell us with any means provided. We'd love to hear from you!