How To Deploy a ASP.NET Website to IIS or Azure

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
deploy a website used to be tricky now in all the built-in help deploy your dotnet website to a local web server or to the cloud can be done minutes today I'm gonna show you the options you have for deploying a full dotnet web site we will cover deploying to a local or remote is server as well as to windows azure since dotnet core is a bit different I'll be covering the deployment options for it in a separate video not to worry though the techniques in this video will also work for dotnet core there's just more options available to it compared to the full Donette framework now if you're new to this channel my name is tim core and it's my goal to make learning c-sharp easier this channel is full of video to explain of various parts of c-sharp i also have a web site where i provide full courses on c-sharp and sequel you can check it out i am tim quarry comm that is also where a blog post for this video is located it includes a source code for my sample application at the start of this video now i'm not including a source code for the end of this video because the only thing really changes is the publication information then that information i have to redact anyways also note that in the description below you can find links of journalists or to support me on patreon okay let's get started in our example project what except here is a basic asp.net MVC website it's practically the fault template I've make a couple modifications that get mine so let's write it first to see how it looks locally okay here we go so this is my website like I said it's mostess the sample app i has changed this stuff right here and also if you click this it goes to I am Tim quarry calm okay so that's all I really did and it also says I am Tim quarry calm down here now what we want to do is not concentrate on the MVC side but instead on how we can deploy our application now honestly if I run this one more time let's do that I'll leave it off a screen but there's a tool that starts in the background the Ament even notice if next o'clock you open up the the icons there you should find one that looks kind of silvery and he right-click on it and say show all applications this is what you get now my it's off a screen sorry it's not a recording screen so I couldn't let you that but this is is Express if it familiar the IAS or Internet Information Services which is what the web server that powers our servers or Windows servers this is essentially its I hate called little brother because it's actually almost full-featured you can do most of what you can is button is express the biggest differences are the UI isn't nearly as comprehensive and it really is focused on just rang it locally but you can get in there and tweak the settings to run it for your whole network if you wanted to don't run a production apt in this but if you want to share with a friend who you're debugging with that's great you can do that so here I have my web demo if I right-click now you can say stop browse or you can put these in groups if you have more than one application running at a time there's a path to where it is and the config file for configuring the website and that's an is configuration so right now we've already essentially deployed it to our local machine I know it doesn't feel like a dying thing but the reality is we're pretty much there so let's go ahead and close this out hit stop which by the way also stops the is Express website but now let's look at our deployment options if I right click on my project and say publish it gives you some options app services which is an azure an azure virtual machine which the difference here is this is a this a sure virtual machine is a full out full web server essentially you control everything from installing Windows I and all the rest whereas app server service you just have the website in a GUI to configure it so it's not even configuring IAF is just a website itself so there's the - azure options we have is and we have folder now for today's demo we're gonna do the top one app service and the bottom one folder now you'd think we can under the is we could and that can use either use web deploy or file transfer using FTP but really this is the same thing only we gotta see what's the process is instead of something else doing it for us so we're going to start with this folder deploy and it's actually gonna deploy in our bin directory in their release folder and it's the publish option so that's it we hit publish it's gonna build it's gonna take a couple of minutes to build everything up well it's actually done and now we're done so if I now right click on web demo say open folder and file explorer there we go go bin directory and now go to release and publish there's the website so that's all we need for a website now let's bring it off a screen from it and let's bring on I'm going to Bri on the control panel so if you open the control panel and you go to its easiest just go to uninstall program click that don't actually unsolved osan or off now I'm on Windows 10 so if I click that it brings up this box here now you are get install but I want to show you I did Internet Information Services I click that box by add a few options under World Wide Web Services application development features I checked the box for asp.net 4.7 now yours may be a little bit different it may be a little bit older version a it's 4.6 or 4.5 that's fine whatever you're publishing in that's okay and if you got published really old websites maybe web forms then you want to check asp.net 3.5 as well but the four dot X whatever that is on your machine is fine okay and then also I took a few others in here you can look at which one I checked but HTTP redirection instead of content errors directory Bratt browsing and default documents and then HTTP logging and tracing both of the features under performance features and finding for security request filtering it's all I have checked so that's how I got mine configure you can add or subtract things and play around that as you feel like you want to but that's where I started off with my IAS and this is on my machine so we're not gonna go to a server today and install there but this is the exact same way you could install on a server so now that I've got I asked him figured if you if you make changes hit okay it's gonna configure it it'll take a few minutes to install on your machine and then you can run it when you do open up IAS server Internet Information Services so this is is manager and here I have a default site which I've already played around with let's create a new site so you can see that from start to finish right click on sites add website again same process on a server let's call this web demo the path we're going to go to see temp demos web deployed demo which actually already has content so we're we're gonna clean that content out and we'll say HDPE that's fine and start website immediately and actually let's put this on a different porch let's put on port 8080 okay so now we have our website let's go browse that and now let's go ahead and this is my my demo making sure it is going to work so we've got now cleaned it out if we were to go to that site nothing would happen it wouldn't work in fact if we write or if you go here to browse port 8080 it opens it up and we get this error right here so now let's bring in our content from our applications there's a folder we're going to now let's go to the folder that we have our data in which I can bring down from here this is the bin release publish folder so if I were to right-click drag over and say copy that's it close that down close that down let's bring our website back down and hit refresh let's wait for it for a minute might've look couple seconds that start the first time because it's gonna start that application pool up but there we go there's a website on a local machine port 8080 if you wanted to you could put a hole in your firewall now and have your machine serve this website either on your personal network on a corporate network or to the entire world if you wanted to more likely what you do is you would do this deployment on a different machine that's a web server but the process is the same you may have FTP access instead of file access that's okay I'm not gonna have to have a teaching I used FTP yeah it's a little confusing sometimes it has some problem that's kind of outside scope as video but essentially you FTP or copy a file in some way to the folder in IAS where wherever your website is pointing to that's it so now we've deployed to is see how simple it was it gets even better if we're deploying to Adger so let's do that next so now I've got this published profile which if I wanted to republish this I could just hit publish again because if there's a folder profile it's gonna publish that folder over again now if I pointed that folder directly to the IAS website you would publish right in the website and refresh it immediately I don't recommend that I can't have a step or two between you publishing in Visual Studio and being on a live website now for the demo site not a big deal you can overwrite those but for anything production I like to have a couple of steps in between where people actually sign off and say yes this is what you want otherwise what happens is you deploy half-done code and your customers actually see it and that's no good so let's create a new profile and this time we're going to create an app service now here's some really cool technology they have built in since it's a sure we can say create new and it will create right here an azure app service for this website it's not created yet measure I hit publish I select my account let's call it let's call it I am Tim quarry web demo that's too long how it would deploy at all notice it's checking name availability seeing that it's good so website deploy demo uses my subscription if you don't have an edger subscription that's kind of important in order to deploy to a sure but they give you some credits for free and some website to plan it for free so definitely check that out in my video on they its top 10 free tools I cover a sure and the the creds you can get from them and how to get started with that so check that out so resource group will use the simple help center one and the hosting plan is fine and we'll hit create now it's going to deploy it's gonna take a couple of minutes because you don't forget we're not just copying files here we're actually first create an entire web app site for us on a sure so it's kind of step 1 create the whole site get all set up put my profile make sure it's launched and ready and then deploy your files from there so it it is a few more minutes than the first time than otherwise would be but really it's not that long a process we're actually almost done so it's moving files over now and it's creating the let's call the access control list it's the security for the different files now one thing I mentioned was doing this is this is a this is a one-time thing it's not a Korea website every time you publish just the first time after that it has baked into it the credentials necessary to keep publishing now here's our website which notice that the URL is websites deploy demo as your website's net which by the way that'll go away after a little bit so don't expect it to last forever I mean it's it's nothing to keep hosting but website deployed deployed demo there's our code that's actually running in the cloud so in just a couple minutes we not only deployed our code to Adger we also built a web app for it first so that's really all there is to publishing a website really simple stuff either you deploy as files into a folder which really if you look at the is or FTP that's all it's all doing it's it's just how it copies those files over web deploy or File Transfer FTP essentially those are just different methods for transferring the files so it's folder deploy same thing app service really simple we create our own or we can select an existing if I wanted to I could create different publish profile here but now that I have my published profiles now whenever I want to publish my website I can just hit the publish button here now if I also set up continuous delivery which will every time I make a change and save it it will publish it out - azure i'm not gonna set that up but you clear if you want to it's a little bit more involved process it's not it's not much but it does have a couple more steps there and it's not so I want to set for this demo however and here's the one 3:40 before you can check outs okay that's all you know there is a larger deployment picture option here and that is this works great for small websites or websites where you're building demos or building sample applications and trying things out however once you get to the point where you have a website they're going to deploy to production and by production I mean somebody other than yourself is going to use it in a real capacity at that point these methods here aren't good enough in my opinion and the reason why is because these don't have any checks and balances in the the process so instead what you want to do is set up a continuous integration and continuous delivery pipeline where you are well first of all have this committed to source control like git and then you push the changes to a server and then on certain commits you then have it built automatically you have tests run against it and then you push to the cloud now I'm going to create a series at some point soon on actually doing that whole process because that's an important process but it's not a quick process it's not a process that you do you out value teach in just an hour it's it's more than that because there's so much involved in it from learning get to learning continuous integration continuous deployment your build server and build definitions and all the rest but that's an important process to put in place anytime you have a production application and the reason why is because then you can have gates in the process where you stop and say is this what we want this right here does not have any gates as soon as I push publish it goes to the website for a production website I prefer to see it and go when I commit my code or save my code I prefer to see it go to a dev site or development site where yes you can see your code yes it's on a live web site but may not lie if your customers just live for you internally and then you test to make sure it's it's working the way you expect it to and you you try things out and try a feature to you is built and make sure they work the way you intend them to and then you take an exact same build and you move it on to a staging server a test at one last time and then you move those changes over to production and that way you have as process where nothing hits production until it's been thoroughly tested and you're exactly sure of what's going on and all the rest so just just keep that in back of your mind that this process that I've taught you today isn't something that you want to do for a production website but as you're building as you're testing as you're doing small applications where it's just a quickly a website yes this works great so just to recap we have folder publish which then we just put into the folder of our web server or we have as your publish which just points to a web app and we hit publish and that's really it okay so that's how you deploy a website now yes we're not deploying desktop applications that's a separate animal they're doing a separate video on that but this showed you had to publish dotnet framework applications to a server very quickly if you have any questions leave them down the comments below I'll try to answer them and if it's a more involved answer I'll put a list for a future video ok thanks for watching and as always I am Tim quarry you [Music]
Info
Channel: IAmTimCorey
Views: 178,117
Rating: 4.8214664 out of 5
Keywords: .net, C#, Visual Studio, code, programming, tutorial, training, how to, tim corey, C# training, C# tutorial, website, deploy, deploy website, deploy web api to iis, deploy web api to azure, deploy web app to azure, deploy web application, deploy website on azure, asp.net, asp.net mvc, asp.net mvc 5
Id: PPaqVyBkwMk
Channel Id: undefined
Length: 21min 28sec (1288 seconds)
Published: Mon Sep 03 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.