Deploy ASP .NET Core Website to Azure VM | IIS | Azure Pipelines | Part1

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hey guys my name is chandan and you're watching educate india in this video we are going to learn about web hosting so if you want to host any website to any server so what is the best process that we can follow so we are going to just use azure devops to create some build pipeline and release pipeline that will handle your deployment and build and finally we are going to deploy this to virtual machine using iis so i have already created one virtual machine using azure cloud so i'll upload some more videos on how we can create a virtual machine using azure cloud so i have used a free trial subscription and using that i have created a windows virtual machine so you can see this is a vm and i have connected using rdp so i'm using mac but i have connected through rdp so i'm able to open the windows server so this will act as a server and in visual studio we are going to create one project and in azure devops we are going to create the pipeline and this will here we are going to store our code also so here we'll use repose to store our code and that will act as a repository and then we are going to create build pipeline and release pipeline and finally we are going to deploy our code to this windows server and then we'll try to access that particular website using internet okay so let's start the video so first we are going to create a basic.net code project so that will be a basic website so simply i'll click on file new solution here we have some predefined template so i'm going to use web application model view controller mvc asp.net core so simply click on next and i am using visual studio for mac so it has a different ui if you are using windows that will have a different ui but you will have all the options there also so here i am selecting target framework as 3.1.net code 3.1 and authentication i am keeping no authentication so let's click on next here the path you can give a different path and then project name and solution name so let's say i'm giving the project name as website now we can click on create so it is going to create one basic mvc project so you can see you have a website solution then you have a website project and it's a basic mvc model view controller project and in view we have cs html files and in controller you will have controller and model you can have classes okay and basic app setting files and program.cs and startup.cs okay so now i'll try to just run it and we'll see what is the output of the file let me select the chrome browser yeah now i'll just run it okay so it's running on localhost and it is just displaying a basic website like welcome page okay with some tabs and links so we'll just do a small modification we'll just modify some content so let's go to index and let's write here this is my first asp.net core website just save it you'll see this is my first asp.net core website so this is our website and now our code is ready so we are going to deploy this on server so we are going to host it on server so one way is simply you can publish this project so right click you can see you have a publish option you can publish to folder you can copy that folder and you can go to server so if this is a server so you can go to c drive and inet pub www root you can simply copy it here and then in ies you can configure it you can just refer that path so that that that's also one way of hosting the project but that is a manual way here we are not going to follow the manual process so we'll just create one pipeline and that will handle your build and deployment so that is a standard way of doing the deployment okay so now we got the code now we are going to push this code to azure devops so if you open the azure devops so right now in repose it's empty there is no any code so we are going to push the same code whatever website we created here and finally from here we are going to create a build pipeline and release pipeline and then we'll try to deploy our code to the windows server okay so let's do this so i'm going to open the terminal and let's see the project i created website project okay so get status okay so these are the different files that we added and we modified index file so i'll simply do git add dot then i'll commit the code i'll write initial commit now i'm going to push the code so to push the code i need this origin i need to copy this so let's run this command i have added the origin and now i'll just push the code i have pushed the code to azure devops so we'll we can see it at repose we have just pushed our code in azure devops just now okay so one step is already done so we have created a website and now we have pushed our code in azure devops now the second step is we need to create a build pipeline and release pipeline okay so in the previous video i have already shown how we can create a build pipeline and in a detailed way so you can just go and watch that video to get a better understanding so here quickly i'm going to create a build pipeline so i will not explain everything because i have already created a separate video but quickly i am going to create a new pipeline for this so we'll hit on new pipeline we'll use a classic editor we'll just select a source educate india master branch continue and here we are going to select the template spinet core will hit on apply it will add the basic task it looks good you can see the source agent okay it looks good now we can just change the name like website save it and we'll run it you can see it's running okay so it will take some time okay so it's telling ubuntu environment okay we need to change the agent let me see what's the agent okay let's cancel it and let me change the agent we want to run this on windows so if you go to pipeline okay agent is ubuntu let's change it to windows and here it looks good okay now save and queue windows okay now run it okay this will take some time so meanwhile we'll create a release pipeline so here we can go we have option to create a new release pipeline we'll click here and here we need to select iis so these are the kind of basic template and what are the advantages of this template if you are using the basic template then it is going to add some predefined task so we are going to select is website deployment let's click on apply and here we'll change the environment stage name so it let's call it dev and later on we can add the artifact so the build is just running so we can add after the build is successful and we can see in the task section it has added basic tasks like is web app manage and is web app deploy so this is going to enable the is so let's check this and this particular task is to create or update so first time it is going to create the website and later on whenever we'll run this particular pipeline so it is going to update the website so if you are doing any modification so we can quickly update it using the release pipeline okay so it can take the latest build and it will just trigger the deployment and these are the different parts like physical path so www root like we saw in the server we have this path i need pub www root so we want to push our dlls and all the executables here okay so let's let's call it website so i'm just modifying the part so it is going to create one folder website and then it will keep all the executables and binaries in the website okay and this is kind of application user passthrough so this is kind of physical path authentication so right now i'm just selecting default application user passthrough so it is going to use ias underscore users and you can give you know and any different windows authentication also if you want so i'm going to use the default for now okay and you can add the bindings also okay like the port name mapping so the you will have binding option here also here in the dev so right now it's showing 80 port if you want to add multiple binding so you can keep just click on add binding and you can modify it so i'll not change it there because i'm i just want to you know show the basic steps and later on we can discuss in detail in the upcoming videos okay and one more thing is we need to select a deployment group so this azure devops it doesn't know like where it has to deploy so we have to add a deployment group like virtual machine details so how we can add the vm details in the pipeline okay so that we can do by creating a deployment group so let me open it in different tab you can see we have a deployment group option so it's saying define a logical group of target machines for parallel deployment okay so we are going to click on deployment here we can give any name okay and we can give any description just click create so this will generate a registration script and personal access token so we'll just check it and we'll just copy this script and wherever you want to deploy or just add this deployment group so just you need to go to that particular virtual machine and just you need to open the powershell and just paste this so whatever we copied from here we have to first check it and we can simply copy it and we need to paste it and just hit enter here you can give no you can simply press enter and it's saying vm educate india started successfully if you go to azure devops and it will click on deployment group so it will say it has added one deployment group educate india app and the target status is one online if you click on available pools so we have this available pool like educate india app go to release pipeline and we'll click on this refresh and we'll select the deployment group so we have added the vm details like we are telling whatever code you want to deploy so just this is a vm detail so this is a target information like this is a deployment group this is the target machine where this particular release pipeline is going to deploy the code so we need to add the target machine so we have just added it by creating the deployment targets okay and before that because this is a dotnet code project so we need to add the dot net core runtime so you can click on plus so install.net core runtime on the server so we'll just simply add it and we can select 3.1 version because we have created project in 3.1 and then after that it it will just perform a is reset and once it installed the dot net core runtime after that it is going to enable the is and then it is going to configure the physical path and all the authentication and finally it is going to deploy so this is a basic set of tasks so no need to modify it if you want to modify it you can give a different name or packages or folders or you have some file related information like file transform and variable substitution so if you want to use json and also you can do it so right now we'll keep it simple we'll understand about these things later in the upcoming videos we have added a simple ies template that has a two task and we have just added one more task for net core runtime the basic steps okay and we'll give a name like website okay release pipeline so let's save it now we'll go to release so we have this pipeline ready you
Info
Channel: Educate India
Views: 18,553
Rating: undefined out of 5
Keywords: Deploy Asp .net core, asp .net core deployment, asp .net deployment, web hosting, iis hosting, iis hosting for .net application, .net web hosting, web hosting using iis, iis setup, deploy website, azure devops, azure pipelines, release pipelines, .net core, asp .net core
Id: uPYWv_sKP7M
Channel Id: undefined
Length: 14min 53sec (893 seconds)
Published: Sat Jun 12 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.