First Application In ASP.NET Core MVC 2.0

Recently Microsoft announced a new version of Asp.Net Core and that is Asp.Net Core 2.0, which has new and amazing features which 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 new project in Asp.Net Core MVC 2.0 with Visual Studio 2017 version 15.3, you have follow below steps.

  1. Go to File menu and click to New and then choose Project.
  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.
  3. Now in the right panel, you will see different kinds of project template; here you have to choose “Net Core Web Application”.
  4. To save your project, provide the valuable name and location and click to OK.

    Asp.Net Core

  5. Next window will provide you different types of template to create web applications and these are as following.
    • 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

      Asp.Net Core
  1. 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.

    Asp.Net Core

Now everything is ready to run this project just press F5 or click to “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 following error that says “Unable to connect to web server 'IIS Express'”.

Asp.Net Core

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

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

Asp.Net Core

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

Asp.Net Core

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.

Asp.Net Core

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

Asp.Net Core

Conclusion

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

I hope this post will help you. Please put your feedback using comment which helps me to improve myself for 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