Skip to main content
AI
  • Get started with AI

    • Red Hat AI

      Accelerate the development and deployment of enterprise AI solutions.

    • AI learning hub

      Explore learning materials and tools, organized by task.

    • AI interactive demos

      Click through scenarios with Red Hat AI, including training LLMs and more.

    • AI/ML learning paths

      Expand your Red Hat OpenShift AI knowledge using these learning resources.

    • AI quickstarts

      Focused AI use cases designed for fast deployment on Red Hat AI platforms.

    • No-cost AI training

      Foundational Red Hat AI training.

  • Featured resources

    • Red Hat OpenShift AI
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

Red Hat AI Factory with NVIDIA

Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.

Learn
  • Self-guided

    • Documentation

      Find answers, get step-by-step guidance, and learn how to use Red Hat products.

    • Learning paths

      Explore curated walkthroughs for common development tasks.

    • Guided learning

      Receive custom learning paths powered by our AI assistant.

    • See all learning
  • Hands-on

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

    • Interactive labs

      Learn by doing in these hands-on, browser-based experiences.

    • Interactive demos

      Click through product features in these guided tours.

  • Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics
  • Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
Build
  • Get started

    • Red Hat build of Podman Desktop

      A downloadable, local development hub to experiment with our products and builds.

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

  • Download products

    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products
  • Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset
  • References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
Community
  • Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions
  • Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github
  • Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

Join the Red Hat Developer program

Download Red Hat products and project builds, access support documentation, learning content, and more.

ConsoleDocsSupport Search
New For you

Recommended

We'll recommend resources you may like as you browse. Try these suggestions for now.

  • Product downloads
  • Cheat sheets
  • Red Hat Developer learning portal
  • Developer blog
  • E-books
  • Developer Sandbox
Log in

Get more with a Red Hat Developer account

  • Product downloads
  • Console access
  • Event registration
  • Training & trials
Explore more account benefitsLog in or register

A subscription may be required for some services.

Contact us

Simplifying ASP.NET applications on OpenShift with the ASP.NET Core S2I Builder

<p>&nbsp;</p> <quillbot-extension-portal></quillbot-extension-portal>

June 16, 2016
Andrew Block
Related topics:
.NETKubernetes
Related products:
Red Hat OpenShift Container Platform

    With recent changes the to the.NET ecosystem, developers of popular languages such as C# now have the ability to develop and deploy .NET applications across multiple platforms including OSX and Linux. This is made possible thanks to the .NET Core, a modular implementation of the .NET framework capable of supporting both web and console applications.

    Aside from opening up opportunities to a new pool of potential developers, .NET Core also enabled these applications to take advantage of certain technologies they were previously restricted from. One of these technologies in particular is Linux Containers. Containerized .NET applications can now benefit from a wide range of features built into containerization technologies such as Docker. This includes a rapid application deployment cycle and portability across machines whether they are located on physical, virtual or hosted in a cloud environment.

    In addition, since these applications are running in containers, they are also eligible to be run in OpenShift, Red Hat’s Platform as a Service product. OpenShift provides the flexibility to manage and run containerized applications while also providing the tools necessary for developers to be productive. It is this ecosystem that gives developers the flexibility and freedom to easily build and deploy applications, without needing to be concerned about the underlying infrastructure.

    OpenShift Source to Image and .NET

    To abstract developers from the underlying Docker image build process, OpenShift provides a feature called Source to Image (S2I). S2I takes an existing image in the docker format, packages an application on top of that existing image, and creates a new container image (also in the Docker format) for deployment onto OpenShift. This originating image is called an S2I builder image and contains the logic to build, deploy, and eventually run the layered application. There are two primary scripts that is used by S2I.

    • assemble – Describes the steps necessary to prepare the source code for deployment. This process typically includes dependency resolution and packaging
    • run - Instructions on how to run the container image to support deployed applications

    These scripts are included in an S2I builder that is available for ASP.NET developers to leverage for deploying their applications into OpenShift. The source code for the builder is located on GitHub at the following location:

    https://github.com/openshift-s2i/s2i-aspnet

    The S2I scripts in this builder utilize the dotnet command line interface (CLI) to prepare the application for deployment and to support the running application. Inside the S2I run script, the dotnet run command is used in conjunction with the application's project.json file to start the application from the previously assembled components. The application itself is deployed on a kestrel based web server that listens on port 5000 from all network interfaces. This allows the application to be invoked by other applications within the OpenShift cluster or connected to a route for external ingress.

    That’s it! The ASP.NET Core framework does the rest to launch the application and make it available for invocation.

    Deploying a Sample Application

    With an understanding of how applications are assembled and run using the ASP.NET S2I builder, let’s walk through how a sample application can utilize the builder to simplify the deployment of ASP.NET applications into an OpenShift environment. The sample application is also located on GitHub and contains both the application source code and an OpenShift template that can be used to set up the necessary project components.

    https://github.com/openshift-s2i/s2i-aspnet-example

    Clone the repository onto your local machine to have assets available to add to OpenShift

    git clone https://github.com/openshift-s2i/s2i-aspnet-example

    The first step when interacting with OpenShift is to login to the environment and create a new project for the sample application. Using the OpenShift command line interface (CLI), create a project called ose-dotnet

    oc new-project ose-dotnet

    Next, add the template to the project so it can be used as the baseline for creating .NET applications. The template is located in a file called aspnet-s2i.json in the templates directory. Execute the following command from the root of the sample application repository to add the aspnet-s2i template to the project:

    oc create –f  templates/aspnet-s2i-template.json

    Now, create an application from the template. The GIT_URI template parameter provides a generic variable that promotes template reuse by multiple applications. Execute the following command specifying the aspnet-s2i template and the location of the sample application's repository to create the application in OpenShift.

    oc new-app --template=aspnet-s2i –p GIT_URI=https://github.com/openshift-s2i/s2i-aspnet-example

    A new S2I build will be initiated to clone the source code from the git repository into the builder which will produce the new image. Once complete, a new deployment of the image will occur. The template also included a route so that the application can be invoked from outside the OpenShift environment. The hostname of the route can be discovered by running the oc get routes command. A result similar to the following will be returned.

    NAME HOST/PORT PATH SERVICE LABELS INSECURE POLICY TLS TERMINATION
     aspnet-app aspnet-app-ose-dotnet.rhel-cdk.10.1.2.2.xip.io aspnet-app app=aspnet-app,template=aspnet-s2i

    The particular deployment of OpenShift is running in the Red Hat Container Development Kit (CDK) and provides a localized environment for working with OpenShift to accelerate the development process.

    Copy the hostname into a browser to verify the application is accessible

    S2I ASP.NET Core

    Congratulations! You just deployed your first ASP.NET application on OpenShift. To allow additional teams to take advantage of this simplified workflow for deploying .NET applications of the own, the template from the sample application can be added to the global openshift project which will make the template accessible by all authenticated users. To do so, execute the following command from the root of the sample application repository:

    oc create –f  templates/aspnet-s2i-template.json -n openshift

    The .NET Core framework has made it easier for ASP.NET developers to expand the reach of their applications. Through the use of the ASP.NET Core S2I builder, a simplified process is available for developers to quickly build and deploy their applications to OpenShift and to take advantage of all of the features available within the platform.

    For additional information and articles on .NET Core visit our .NET Core web page for more on this topic.

    Last updated: May 29, 2023

    Recent Posts

    • A day in the life of an NVIDIA H100 on Red Hat OpenShift 5

    • Migrate BuildConfigs to builds for Red Hat OpenShift with one plug-in install

    • Run Red Hat Enterprise Linux CoreOS on NVIDIA BlueField DPUs

    • Agent harness engineering: Separating model capabilities from enforcement

    • What's new for developers in Red Hat Enterprise Linux 10.3 and 9.9

    What’s up next?

     

    Red Hat Developers logo

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    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
    © 2026 Red Hat

    Red Hat legal and privacy links

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