Hello World Program in Asp.Net Core

Hello Everyone,

Lets learn today hello world program in Asp.Net Core which is the basic program which comes under the radar, whenever we start to learn any new programming languages.

I would like to pin this hello world program to one of the famous stories which we would have read or gone through in our childhood days Vikram and Betal. Where ever we go, hello world program follows us.

Before getting started with hello world program, i will brief you on the things i have used to create this hello world program

1) Laptop with basic modern configurations

2) Windows 10

3) Visual Studio 2017

Visual Studio Free Community Edition Developer Friendly can be downloaded from the below links -

https://visualstudio.microsoft.com/free-developer-offers

Today lets learn how to create hello world program in asp.net core -

1st Point - Open Visual Studio which is installed in your System/Laptop (Preferably choose visual studio greater than 2015)

2nd Point - Click on File -->  New --> Project  --> ASP.NET Core Web Application (.NET Core)

Give a Name to your project and click OK, In this example i have named it as HelloWorldInAspNetCore

3rd Point - Select Web Application (Model-View-Controller) Template and Uncheck Configure for HTTPS Checkbox and Click OK.

4th Point - Now you can see the default scaffolding project files provided by Microsoft for Asp.net Core Web Development 

5th Point - Run the project, by clicking CTRL + F5 or F5 Key or Click on IISExpress provided in the Standard tool bar.

You can see the Output Screen as shown below -

6th Point - Our Goal is too create hello world program, so lets add new controller, In Solution Explorer, Right click on Controller Folder --> Add --> New Item --> Controller Class (Asp.net Core MVC) and name it as HelloWorldController.cs and Click Add

7th Point - In the HelloWordController.cs, we shall return the string Hello World as output by doing some small coding stuff, Since the return type is string we have replaced the IActionResult with string in GET API Method of HelloWorldController.cs

8th Point - By Default our project is pointing to HomeController Page in the startup.cs (MVC Routes), So lets point to HelloWorldController and start running the project by CTRL + F5 or F5.


 
FINAL OUTPUT -  THAT'S IT, we have achieved the desired result HURRAY !


Please feel free to ask any questions or post your comments on feedback.

If you liked this articulated programming blog, Please do like, share and subscribe !

Thanking You All for your Support in Advance !

Happy Learning and Programming !!! 

With Best Regards,

Harsha.D

Sr Software Engineer,

Email - harsha.devrajan@gmail.com


MORE IS COMING SOON !!!



Comments

  1. hey i have read your blog it is useful but the problem, i am facing is whenever i try to run IIS express or start without debugging it doesn't open browser for me. it does nothing just build and literally nothing

    ReplyDelete

Post a Comment