Published:

.NET - Create and Run a Simple 'Hello World' Web App

With the .NET CLI you can create a new project with the dotnet new <TEMPLATE> command, where the TEMPLATE is the type of application you want to create. To create a .NET Web App execute the command dotnet new web --name <NAME>, the NAME parameter sets the name of the .NET project and directory created, if omitted the name of the current directory is used.

The web template creates a simple Hello World .NET starter web application that contains some basic configuration and a single endpoint that returns the string "Hello World!" from the base path ("/").

Follow these steps to create a starter .NET web application named MyWebApp and open it in VS Code.

  1. Install the .NET SDK from https://dotnet.microsoft.com/download, includes the .NET runtime and CLI
  2. Run the command dotnet new web --name MyWebApp to create a new web app named MyWebApp
  3. Navigate into the web app directory with the command cd MyWebApp
  4. Start the .NET web app with the command dotnet run
  5. Open the web app in a browser using the URL from the command output (Now listening on: http://localhost:[PORT NUMBER])

For more info on the dotnet new command see https://docs.microsoft.com/dotnet/core/tools/dotnet-new.

 


Subscribe or Follow Me For Updates

Subscribe to my YouTube channel or follow me on Twitter, Facebook or GitHub to be notified when I post new content.

Other than coding...

I'm currently attempting to travel around Australia by motorcycle with my wife Tina on a pair of Royal Enfield Himalayans. You can follow our adventures on YouTube, Instagram and Facebook.


Need Some .NET Help?

Search fiverr to find help quickly from experienced .NET developers.



Supported by