Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Three ways to containerize .NET applications on Red Hat OpenShift

March 16, 2021
Don Schenck
Related topics:
Containers.NETKubernetesLinux

Share:

    When Microsoft announced in November 2014 that the .NET Framework would be open source, the .NET developer's world shifted. This was not a slight drift in a new direction; it was a tectonic movement with huge implications.

    For one thing, it positioned .NET developers to take part in the rapidly-growing world of Linux containers. As container development matured to include technologies such as Kubernetes, Knative, and Red Hat OpenShift, .NET developers faced the opportunity—and challenge—of moving existing applications to use microservices and containers.

    Fortunately, we have options. This article describes three paths for .NET development for OpenShift: Linux containers, Windows containers, and OpenShift container-native virtualization.

    Linux is containers, containers are Linux

    .NET Core is the most obvious and direct route to .NET in containers. Containerizing a .NET Core application is as simple as writing a Dockerfile and building the image using Podman or Docker. While it does require either a Linux-based computer or the proper Windows-based environment (Hyper-V or Windows Subsystem for Linux 2), no special steps or OpenShift technologies are needed. Build the image and import it to OpenShift.

    Using Linux containers would seem to be the preferred route for new ("greenfield") applications because no porting or rewriting is needed. If you want to port an existing application, two tools can help: Microsoft's ApiPort and Amazon's Porting Assistant for .NET.

    If you want to start writing .NET applications to run in containers while keeping your existing monolith running in Windows, I suggest learning about the strangler pattern.

    If you want to start a new application, or if you can easily port your current application, or if you want to employ the strangler pattern, .NET Core running Linux containers is the way to go.

    But what if you want to move an existing .NET Framework application immediately?

    Windows containers

    The long-awaited Windows containers technology is here and ready for you to run with it on OpenShift. Using the same management model—and the same management plane—as Linux containers, Windows containers allow you to build and run images on the Windows operating system.

    What is the practical takeaway of this? How about the ability to run .NET Framework applications in containers? Yes, Framework. Not Core; Framework. Let your imagination run wild with that for a moment. Build a Windows container image, and running your IIS website can be as easy as docker run -d -p 80:80 my-iis-website.

    There are, of course, a few things to consider when using this approach. I will explore these points in an upcoming article about Windows containers on OpenShift. Stay tuned.

    OpenShift CNV

    OpenShift container-native virtualization, or CNV, is built on the KubeVirt technology. The KubeVirt project lets you control a virtual machine (VM) with Kubernetes, treating it like a container. The many advantages of this technology, coupled with OpenShift, include immediate lift-and-shift without any code changes, role-based access control (RBAC) and networking policies as afforded by OpenShift, and more. In short, you get all the advantages of Kubernetes and OpenShift while keeping your Windows VM running.

    If you want to move your legacy .NET Framework applications to OpenShift and benefit from its features immediately, this route could be the best. It buys you time as you evaluate your path forward, which might include containers—Windows, Linux, or both.

    More to come

    This article was only a brief introduction to the latest technologies for containerizing .NET applications. Your individual path depends on your situation, budget, time, and so on. To help make the decision easier, look for three more articles on this topic—one for each path: Linux containers, Windows containers, and OpenShift CNV with a Windows VM.

    Last updated: April 15, 2021

    Recent Posts

    • Meet the Red Hat Node.js team at PowerUP 2025

    • How to use pipelines for AI/ML automation at the edge

    • What's new in network observability 1.8

    • LLM Compressor: Optimize LLMs for low-latency deployments

    • How to set up NVIDIA NIM on Red Hat OpenShift AI

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue