Support us on YouTube by Subscribing our YouTube Channel. Click here to Subscribe our YouTube Channel

Sunday, 23 May 2021

Monday, 26 April 2021

Wednesday, 14 April 2021

How to install Visual Studio 2019

In this article, we will see How to install Visual Studio 2019 in the windows 10 operating system.

Microsoft Visual Studio is an Integrated Development Environment (IDE) which is used to develop computer programs, websites, web applications, web services, mobile applications, etc. It supports around 36 different programming languages with a code editor having IntelliSense (code completion component). One of the most basic and popular editions of Visual Studio is Community Edition. Visual Studio includes a debugger that works both as a source-level debugger and as a machine-level debugger. Debugger allows setting the breakpoints and watches to monitor the value of the variables as the execution progresses.


Visit https://visualstudio.microsoft.com/ in order to download Visual Studio as per your system architecture as well as requirement.
Choose Visual Studio Edition which you want to install in your machine. I will recommend you to download Community Edition, which is best for Students or Individual Developers.
On selecting the edition, an executable setup of Visual Studio is downloaded. Click on the .exe file in order to start the installation process. On the first screen, you can see the privacy and license terms, click on continue.
In the next step, it will download the files required to proceed with the installation.
Once all files are downloaded, a screen as shown in the below image will appear. Select the workload as per your development requirement. You can also select the Individual components; language packs, etc., and then click on Install. On the right-hand side, it will show the total space required for the installation.
Selected workloads, components will start downloading. Select the start after installation checkbox option in case if you want to start the Visual Studio after the installation.
Once installation is done, search for the Visual Studio (in my case it's Visual Studio 2019) in the Start Button. Click on it in order to launch the application.
You are now ready to develop cool applications. Create a new project or open an existing project or solution.
I hope this article will help you in installing Visual Studio.
Thanks.

Wednesday, 31 March 2021

Understanding OutOfProcess Hosting Model in ASP.NET Core

In this article, we will learn OutOfProcess Hosting Model in ASP.NET Core. If you are new to ASP.NET Core, then I will recommend you to go through the below articles of this series:

In the previous article, we learned, How to configure InProcess hosting model in ASP.NET Core. We configured the AspNetCoreHostingModel value as InProcess in the .csproj file and saw that the application is hosted through IISExpress / wpw3.exe worker process.
In this article, we will see how to host an application on the OutOfProcess hosting model. In OutOfProcess hosting model, there are two web servers, one is Internal Web Server which is basically a Kestrel server and another is External Web Server which can be either IIS, Ngnix, Apache, etc. dotnet.exe is the process that runs and hosts the application with the Kestrel Web Server.

1. Internal Web Server: In an internal web server, the Kestrel web server is the internet-facing web server as all the HTTP requests are directly processed by it.
2. External Web Server: In External Web Server, Reverse proxy server which can be either IIS, Ngnix, Apache, etc. is used along with Kestrel web Server. A reverse Proxy server provides additional security as well as configurations that are not available in Kestrel Server. It also provides load balancing functionality.

Let’s edit the .csproj file and set AspNetCoreHostingModel value as OutOfProcess (Value of AspNetCoreHostingModel is case-insensitive)

Or we can also change its value by right-clicking on the project and click on the properties as shown in the below image.
Click on debug menu, and change the value of the Hosting Model from the dropdown to OutOfProcess. We can use any one method in order to change the Hosting Model.
Now let’s run the application through IIS Express. You can see that the application is served through Kestrel Server (with DotNet.exe process)


Now let’s run the Application through Launch Application by selecting the profile to run the application with DotNet CLI or by the DotNet CLI command in order to check the Worker Process / Server serving the application. As we can see Kestrel server is serving the application.


Some of the difference between the InProcess vs OutOfProcess hosting model are:
1. In InProcess hosting model, request and response are served through w3wp.exe or IISExpress whereas in the OutOfProcess worker process involved is dotnet.exe
2. In InProcess hosting model, single web server is used whereas, In OutOfProcess hosting model, two web servers can be used.
3. InProcess hosting model provides better performance as compared to OutOfProcess hosting model. 

I hope this article helped you in understanding the OutOfProcess hosting model.
Thanks.

Saturday, 27 March 2021

Understanding InProcess Hosting Model in ASP.NET Core

In this article, we will learn about one of the AspNetCoreHostingModel i.e. InProcess Hosting Model. If you are new to this ASP.NET Core tutorials series then I will recommend you to check the below articles:

Saturday, 20 March 2021

Thursday, 11 March 2021

Create ASP.NET Core Web Application with Visual Studio Code

In this article, we will see How to create an empty ASP.NET Web Application with .NET CLI and Visual Studio Code. In the previous article of this series, we already covered the below articles. 

I recommend you to go through these articles first if you are new to this series or new to .Net Core Technology.
In order to create the .Net Core application, we must have .Net Core SDK installed in the system. (In this example, I am using .Net Core 3.1). Go to the Microsoft official website in order to download the .Net Core SDK.
Once SDK is installed, Open Visual Studio Code Editor. If you don’t have it already installed in your system, then go to the Microsoft official site in order to download it free of cost. Once downloaded and installed, Go to the Terminal menu, click on New Terminal.
You will see the terminal as shown in the below image.
Change the directory to the location where you want to create your first ASP.NET Core Web Application with .Net CLI. In my case, I already created a folder on the desktop (and named it as Project).
Run the dotnet command in the terminal. If dotnet core is already installed in your system, then you will see the options as shown in the below image.
Run the dotnet --version command in order to check the version of .Net Core SDK installed in your system. In my system, I have .Net Core 3.1.402 Version.
You can use --help in order to check the options and commands in case of any help required. Use the dotnet new command in order to create a new project and pass the short name for the type of project/solution you want to create. You can use the--help in order to the available projects as well as options related to .Net Core CLI.
As you can see, we can create several kinds of projects through .Net Core CLI. In this example, I am going to create an ASP.NET Core Empty project.
Run dotnet new web --name <NAME_OF_PROJECT> in order to create an empty ASP.NET Core web application. On executing the command, ASP.Net Core Empty template will be created followed by the dotnet restore command.
Now change the directory to the project location. In my case, I have created a project i.e. AspNetCoreEmptyWebApp so I am changing the directory through the terminal to that folder as it contains the .csproj file which is required to run the .Net Core project through the CLI. Once the directory is changed, run dotnet run command in the terminal in order to launch the web application.
Once the application is launched successfully, copy or click on the URL on which your application is running. You can see Hello World! on the screen which is basically coming from the startup.cs class.
Now let’s open that project into Visual Studio Code. We can directly open the folder through the File menu and clicking on the open folder menu option or by running “code .” in the terminal as shown in the below image.
On opening the project for the first time, A message is prompted to add the required assets to build and debug the application. Click on Yes. On clicking on Yes, a folder i.e. .vscode will be created in the project.
You can see that our ASP.NET Core project is opened in the Visual Studio Code editor with the structure as shown in the below image. (Please check, Project Structure in ASP.NET Core 3.1 Web Application in case you want to understand the project as well as files structure and its role)
Now, go to the Run menu, click on Run without debugging in order to run the application without debugging it. In a few seconds application is launched with the ports specified in the launchsettings.json file.

In case you want to debug the application, add the breakpoint where you want to test and debug the application.
And then go to the Run menu & then click on the Start Debugging option. Once the application reached the breakpoint, it will be highlighted (in a similar manner as in Visual Studio IDE). You can do step in, step out, add items to the watch window, etc.


I hope this article will help you in getting started with creating and managing the ASP.NET Core web application with .Net CLI and launching & debugging it through Visual Studio Code.
Thanks.


Saturday, 6 March 2021

Project Structure in ASP.NET Core 3.1 Web Application

In this article, we will learn about the Project Structure of the ASP.NET Core 3.1 Web Application. This is the continuation of the ASP.NET 3.1 Tutorials series. I will recommend you to go through the below article of this series if not already gone through that:

As in the previous article, we created an empty ASP.NET Core Project and the structure of the project is as shown in the below image.
Let’s start exploring each folder and file that exists in the Project Structure for ease of understanding.

.csproj File: Right-click on the project and then click on Edit Project File in order to edit the .csproj file (In .NET Framework we can’t see that option until the project is unloaded from the solution explorer and the content of .csproj was quite difficult to understand).
Once clicked on Edit Project File, .csproj file will be opened in Visual Studio as shown below.
As you can see TargetFramework element specifies the target framework of our ASP.NET Core application. Netcoreapp3.1 is the TFM that stands for the Target Framework Moniker. On adding the dependencies through NuGet, it will add another ItemGroup element which contains the details of the Package in PackageReference element.

launchSettings.json: Properties folder contains a file i.e. launchSettings.json file which contains all the information required to launch the application. It contains the profiles through which the application can be run, each profile is mapped to a commandName, applicationUrl on which application is launched, environmentVariables, etc.
As you can see, In the above launch setting we have two profiles. One will launch the application on IIS Express and another through the Kestral Server (used in the case when the application is run through the DotNet CLI or profile is selected through the Visual Studio Launch icon).

appsettings.json: In .Net Framework, we store application-level settings or configuration in the web.config. In the .Net Core framework, appsettings.json will do the same work. All the connection strings, application-related settings are stores in the appsettings.json file in JSON format.

Program.cs: Program.cs file contains the main method which is the entry point for the application. It will create a web host builder and configure the services defined in Startup.cs file.

Startup.cs
: Startup.cs file used to define all services used in the application and configure the HTTP Request pipeline with the use of middleware components. It contains ConfigureServices method where you can register the services, classes with the use of built-in DI Container, and Configure method which is used to configure the HTTP Request Pipeline. Request pipeline is configured with the help of middleware components. We will learn in detail about the middleware component in the up coming article of this series.

wwwroot Folder: A wwwroot folder needs to be created in order to serve and store static files like CSS, Javascript, images, icons, etc. We will see its usage when we learn about the Static Files in the upcoming articles of this series.

Another interesting feature of the ASP.NET Core Project that files in the project are sync with the files in the system in real-time. Let say on adding a file through the file explorer in the project (not through Visual Studio), files created/altered immediately reflected in the Solution Explorer window. If we delete any file through file explorer, the file will be deleted immediately from the solution explorer as well. In the older version of .Net Framework, we need to include and exclude files manually if files added/deleted through the windows explorer window.
I hope this article helps you in understanding the basic Folder/Project architecture of the ASP.Net Core project.
Thanks

Subscribe us on YouTube

Subscribe Now

Popular Posts

Contact us

Name

Email *

Message *

Like us on Facebook

Blog Archive