How to quickly spin up a web server using dotnet CLI

Prerequisites: .NET (dotnet CLI) must be installed on your PC/laptop/Machine, you can download it from the below mentioined link 

https://learn.microsoft.com/en-us/dotnet/core/install/


Here are the steps to quickly spin up a web server using dotnet CLI

Step 1. Dotnet CLI allows creating a new project, in our case we need to create a new web project, for that we need to run the following command

  • dotnet new web myWebApp
    • this command shall give us boilerplate code for a web api with a base route with some 'Hello World' stuff!
Step 2: After this we need to build this newly created project, for that we need to run the following command
  • dotnet build
Step 3: Run the created build
  • dotnet run
    • This would run the server on some localhost port

You can then visit the localhost port to check if everything is working or not and then debug accordingly.

Comments