Difficulty: beginner
Estimated Time: 20-30 minutes

Using ASP.NET in OpenShift

So, you want to try out ASP.NET on OpenShift? You'll see just how easy it is in the next few minutes.

This scenario was written specifically to introduce you to putting your ASP.NET project in OpenShift, and to go over some of the advantages of using OpenShift for ASP.NET.

If you are completely new to OpenShift, then please check out the beginning OpenShift for developers scenario.

Using OpenShift

This scenario will run an OpenShift cluster for you inside of Katacoda. If you'd like to try OpenShift outside of this scenario, then check out OpenShift Online, and sign up for free. You can play around more with the tools that you'll be learning in this scenario. If you'd like to run OpenShift locally for further experimentation, then take a look at OpenShift Origin.

If you're new to using ASP.NET and want to learn how to make the simple app that's used in this scenario, then check out my blog series on Getting Started in ASP.NET on OpenShift.

This scenario will work with the web console. However, OpenShift also has a CLI called OpenShift Origin Tools, or OC Tools, that you can use through the terminal in Katacoda. You can also download it for your own use with OpenShift Origin or when running OpenShift locally.

Why OpenShift for .NET?

If you're looking at this scenario, you probably already know why you're using ASP.NET Core, such as how simple its Razer syntax makes embedding C# code into your pages.

What may be new to you is how good OpenShift is for your ASP.NET code. To explore that, we'll upload the project that's created for the Getting Started blogs (found here if you want to take a look at the code) and go over a few cool things that you can do with your project in OpenShift, such as vertical and horizontal scaling.

Almost Done!

You just finished learning the basics of how to get started with .NET on OpenShift Container Platform. You've probably seen that OpenShift is very talented and has a lot more to offer for developers and DevOps. Here are some things that you might want to give a try with your ASP.NET projects:

  • Vertical Scaling
  • Horizontal Scaling
  • Health Checks
  • Self-Healing

What's next?

Keep experimenting with OpenShift in additional Katacoda tutorials, and on your own! Here are some more resources:

OpenShift CLI Cheatsheets for Devs and SysAdmin

Coming soon! In the meantime, take a look at...

Free eBooks:

OpenShift for Developers: A Guide for Impatient Beginners

DevOps with OpenShift: Cloud Deployments Made Easy


Minishift is a complete OpenShift environment that you can run on your local machine. The project supports Windows, OS X, and the Linux operating system. To find more about Minishift, visit: http://www.openshift.org/vm

OpenShift Origin

The OpenShift Origin site provides the latest OpenShift Origin Server as well as the OpenShift Client Tools binaries: https://www.openshift.org/download.html

oc cluster up

oc cluster up is a command provided by OC Tools. It configures and runs an OpenShift environment running inside of the native Docker system for your operating system. It supports Windows, OS X, and Linux. To get started with OC Tools, visit: https://github.com/openshift/origin/blob/master/docs/cluster_up_down.md

If you decide to try out oc cluster up, and you should, I would also suggest that you take a look at a wrapper script that was created to make life a little bit easier for you called oc cluster wrapper. This wrapper provides functionality such as the ability to have different profiles, persistent volume management, and other great features. You can find more information at the official Git repository at: https://github.com/openshift-evangelists/oc-cluster-wrapper

To learn more about working with CLI, check out other tutorials on this site, as well as this reference for getting started: https://docs.openshift.org/latest/cli_reference/get_started_cli.html

OpenShift Online

The OpenShift team provides a hosted environment with a free tier for you to try out your own projects and get a quick taste of what OpenShift can provide: http://openshift.com

OpenShift Dedicated

You can also let Red Hat host an OpenShift instance for you on a public cloud. This is an ideal scenario for larger teams that don't want to deal with the operational aspects of running a full environment. To find out more, visit: https://www.openshift.com/dedicated/


Step 1 of 3

Step 1 - Using .NET Core on OpenShift

Creating Your Project

To begin, click on the Dashboard tab in the console frame of this browser window. This will open the web console link in another tab or window of your browser.

You should see an OpenShift Origin window with Username and Password forms.

For this scenario, start by entering the following:

Username: developer

Password: developer

After logging in to the web console, you'll see a button labeled: New Project. Click this to get started.

You should now see a page for creating your first project in web console. Fill it in with the following:

New project



The rest is optional, but fill it in if it helps you.

After your project is created, you'll be taken to a screen where you can begin adding content to your project.

Deploying .NET Core S2I

The first thing that we'll need to add is the .NET Core source-to-image (s2i). The quickest way to do that will be by navigating to the link, and copying all from the JSON file. Next, select the Import YAML / JSON tab, and paste the code from the JSON in the previous link into the form. Click Create.

After you receive a message that says "Creating resources in project..." click Add to Project to return to the Browse Catalog view. Now, you should see .NET as an option. You're on your way!