First Application In ASP.NET Core MVC 2.0

Introduction

Recently Microsoft announced a new version of Asp.Net Core and that is Asp.Net Core 2.0, which has new and amazing features that not only improve performance but also increase productivity and enhance your application making it more robust and reliable.

You can use Asp.Net Core 2.0 with Visual Studio 2017 version 15.3. To use .Net Core 2.0 features, first you can .NET Core SDK 2.0 and then upgrade Visual Studio 2015 or 2017 using “Visual Studio Installer” with .Net Framework 4.6 and higher version Or you can do a fresh installation of Visual Studio 2017 version 15.3 and must select .Net Framework 4.7.

To create a new project in Asp.Net Core MVC 2.0 with Visual Studio 2017 version 15.3, you have to follow the below steps.

Step 1. Go to the File menu click on New and then choose Project.

Step 2. From the New Project window, first you have to choose .Net Framework 4.6 or above version and then from the left panel, choose Visual C# and then .Net Core.

Step 3. Now in the right panel, you will see different kinds of project templates; here you have to choose “Net Core Web Application”.

Step 4. To save your project, provide the valuable name and location and click to OK.

Asp.Net Core

Next window will provide you with different types of templates to create web applications and these are as follows.

  • Empty Template for basic configuration.
  • Web API for creating Rest API
  • Web Application to create Razor Pages Application
  • Web Application (Model-View-Controller) to create Asp.Net Core MVC 2.0 application
  • Angular to create SPA application with Angular 2 or above version
  • js to create SPA application with React.js
  • js to create SPA application with React.js and Redux
    SPA application

From the authentication, you have to choose “No Authentication” and then click to OK button.

It will take a few moments to configure your application and finally, the project is ready for you with the following project structure.

No Authentication

Now everything is ready to run this project just press F5 or click on “IIS Express”, it will take a few minutes to install all dependencies. If you have newly installed .Net Core SDK 2.0 or installed Visual Studio 2017 version 15.3 then it might be you will get the following error that says “Unable to connect to web server 'IIS Express'”.

IIS Express

To resolve this issue, you have to make minor changes to the project configuration. Go to project properties and choose Debug Tab from the right pane.

From the Web Server Setting, you have made changes in the App URL, only change PORT [I have changed only one digit] and save the project.

 App URL

Now the project is ready to run and now once again press F5. It will Rebuild the solution and run the application. But unfortunately, I got another error as follows.

Rebuild

To resolve this you have disabled “Chrome script debugging in Visual Studio”. To do that go to Tools menu and choose Options.

From the Debugging option, choose General and find the following option as shown in the image. You have to disable it.

Debugging option

When you run the project again, it will run and the output will be as follows. This is our first Asp.Net Core MVC 2.0 application.

Asp.Net Core MVC 2.0

Conclusion

So, today we have learned how to create the first Asp.Net Core MVC 2.0 application.

I hope this post will help you. Please put your feedback using comments which helps me to improve myself for the next post. If you have any doubts please ask your doubts or query in the comment section and if you like this post, please share it with your friends. Thanks