Getting Started With ASP.NET 5 Web Application

This article is for starting with ASP.NET 5 Web Application. We are going to also learn new fundamental concepts of ASP.NET 5.

Introduction

In this article we are going to learn ASP.NET 5, and how to create web applications using Visual Studio 2015. We are going to also learn new fundamental concepts of ASP.NET 5.

Creating ASP.NET 5 Web Application

The following are the steps to create ASP.NET 5 web application in Visual Studio 2015:

1. Start Visual Studio 2015.

Visual Studio 2015

2. From the File menu, select New -> Project.

3. Select the ASP.NET Web Application project template. It appears under Installed > Templates > Visual C# > Web. Name the project or leave as it is and click OK.

Web

4. Select ASP.NET 5 Templates, then Web Application and click OK.

Web Application

5. You can see the following screenshot, creating project ‘WebApplication1',

WebApplication1

6. After that the following project is created successfully.

project

ASP.NET 5 Project Structure

The ASP.NET 5 defines the new project structure for the web application. In this structure it defines two folders in solution as follows:

1. Solution Items – it contains global.json file.

2. Src – it contains the web application.

The following image shows how new ASP.NET 5 project structure looks:

structure

It also creates some initial folders for your projects as the above screen shot like – Controllers, Migrations, Models, ViewModels, and Views etc. In the above screen shot you can see two new folders are added in ASP.NET 5 Migrations (for Entity Framework) and ViewModels (for Data Transfer Objects (DTOs)).

The wwwroot Folder

It contains all the static files in your project; go into this folder. Code files are placed outside of this folder. This folder contains the clean and clear separation between the static files and code files.

file

The global.json File

This file contains the configuration of the project, created by visual studio. See following screen shot:

configuration

The appsettings.json File

This file contains information about the project, like connection string etc. See following screen shot:

information

The project.json File

This file is new in ASP.NET 5 web application. It contains the information about the project – like which framework is used, server side dependencies, commands, and scripts etc. you can see the latest framework of EF7 is in dependencies section, see following screen shot,

section

Client Side Dependencies

Dependency’s


Server Side Dependencies:

Dependency’s

Running the Application

Here's the screenshot,

application

After successful build, it's open in the browser you selected.

build

Output shows like the following screen in browser:

browser

browser

browser

browser

In this above screen you can see default page of web application we have created. This is the new look of ASP.NET 5 default page.

Following are some differences of Previous and ASP.NET 5 Web Applications as follows:

1. When you open application in File Explorer.

Previous ASP.NET,

ASP.NET

ASP.NET 5

ASP.NET 5

2. Difference in size of application.

application

3. Difference in ASP.NET Project Structure.

StructureStructure

Summary

I hope this article is useful for all readers. You learned about ASP.NET 5 with creating simple web applications and project structure. If you have any suggestion regarding this article, then please contact me!

 

Thanks for reading. Learn it! Share it!

Read more articles on ASP.NET: