How to create a Hello World web app using ASP.NET Core?
This is tutorial will help you to create a Hello World web app using ASP.NET Core. If you are looking for a tutorial for “How to create a Hello World web app using ASP.NET Core?” then this will help you a lot.
IF you don’t have .NET installed in your system then you first need to install .NET SDK (Software Development Kit). Download .NET SDK from here => Link
Check everything installed correctly
Once you’ve installed it, open a new command prompt and run the following command:
If the installation succeeded, you should see an output similar to the following:
Usage: dotnet [options] Usage: dotnet [path-to-application] Options: -h|--help Display help. --info Display .NET information. --list-sdks Display the installed SDKs. --list-runtimes Display the installed runtimes. path-to-application: The path to an application .dll file to execute.
Now it’s time to create the first new web app.
Create your web app
In your command prompt, run the following command to create your app:
> dotnet new webApp -o HelloWorldWebApp --no-https
Then, navigate to the new directory created by the previous command:
> cd HelloWorldWebApp
What do these commands mean?
dotnet new the command creates a new application.
webAppparameter selects what template to use when creating your app.
-oparameter creates a directory named
HelloWorldWebAppwhere your app is stored.
--no-httpsflag specifies not to enable HTTPS.
cd HelloWorldWebAppthe command puts you into the newly created app directory.
What files were created?
Several files were created in the
HelloWorldWebAppdirectory to give you a simple web application that is ready to run.
Startup.cscontains the app startup code and middleware configuration.
HelloWorldWebApp/Pagesdirectory contains some example web pages for the application.
HelloWorldWebApp.csprojdefines what libraries are referenced etc.
It’s time to run your app
In your command prompt, run the following command:
> dotnet watch run
dotnet watch run the command will build and start the app, and then rebuild and restart the app whenever you make code changes. You can stop the app at any time by selecting Ctrl+C.
Wait for the app to display that it’s listening on
http://localhost:5000 and for the browser to launch at that address.
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?