ASP NET Core launchsettings json file

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
this is part 8 of asp.net core tutorial in this video we'll discuss the significance of launch setting strategies and file in an asp.net project you'll find this file in the properties folder in solution Explorer the settings in this file are used when we run this asp.net core project either from visual studio or by using dotnet core CLI the important point to keep in mind is this file is only required on our local development machine we do not need it for publishing our asp.net core application if there are certain settings that you want your asp.net core application to use when you publish and deploy your app store those settings in this app settings dot JSON file we usually store our application configuration settings in this file we can also have environment specific app setting strategies and files for example app settings dot staging dot JSON for the staging environment similarly for the development environment we'll have app settings dot development dot JSON in addition to these app settings dot JSON files we also have other configuration sources like environment variables uses he crates command line arguments and even our own custom configuration source more on these different configuration sources and app settings dot JSON file in our next video now if we take a look at the settings in this launch setting store JSON file notice we've got two profiles is Express and another profile with the same name as that of our project which is employee management now when we run this project from visual studio by pressing ctrl f5 or just f5 then this profile is Express is used let's actually run our project by pressing ctrl f5 notice the port number in the address bar 15 4 10 where is it configured well that's in our launch profile is Express the settings for this profile are right here notice application URL the port number is configured here 15 410 which is what we see in the browser address bar if we want to change it we can do so using application URL similarly we can also configure ssl port and here we're also setting this environment variable s been at core underscore environment to development we can change this value to staging or production depending on whether we are running this project in staging or production environment you can also add new environment variables these environment variables are available throughout or asp.net core application and we can include the code that conditionally executes depending on a value of these environment variables for example if we take a look at this startup dot CS file notice this piece of code right here we are checking if the environment is development since we have set the environment variable to development this condition is going to return true and this piece of code will be executed meaning on a development environment developer exception page is displayed now if we are running this same app on a staging environment then on that staging environment will set this environment variable to staging that means this condition right here is going to return false and this piece of code will not be executed meaning on another environment are the land development the developer exception page is not displayed so we have the code conditionally executing depending on the value of the environment variables but it is this environment variables and the developer exception page in detail in our upcoming videos back on our launch settings dot JSON file as the name implies this file contains launch profiles the profiles to launch and run our SP dot encode project on our local development machine at the moment in this file we have to launch profiles this first profile is Express is used by default when we run the project directly from Visual Studio by pressing ctrl f5 or just f5 this second profile which has the same name as that of our project employee management this profile is used when we run this asp.net core project using the.net core CLI notice the port number at which our application is running and listening for the incoming HTTP request it is five thousand and that port number is configured right here so this proves when we run the project using dotnet course Eli this profile employee management is used now if we take a look at this drop-down list notice both the profiles are listed here by default visual studio uses is Express profile we can change this to employee management when we do this and run the project Bridget studio launches dotnet core CLI and dotnet cool CLI runs our project let's prove this first let's share our application down and run the project from visual studio we expect visual studio to launch dotnet core CLI so we should see another command prompt window popping up and not net core CLI running our project there we go notice the port number it's 5,000 that's the port number configured within our employee management launch profile right here let's stop our application now let's open the project file notice this SP net core hosting model element this element value along with the command name property value determines the internal and external web server to use remember in asp.net core we have two web servers an internal web server which is the kestrel server and an external web server which can be IAS nginx our Apache the external web server is commonly called as reverse proxy server we discuss this in detail in our previous video the point that I'm trying to make is this SP net core hosting model element value along with this command name property value determines the internal and external web server to use this command name property can have a value of IAS Express project or IAS now let's look at a chart that shows the internal and external web server used if we done our asp.net core project using a launch profile where the command name property is set to project then the SP net code hosting model element value in the project file is completely ignored and only one web server is used and that is kestrel let screw this notice in Visual Studio we have this launch profile selected employee management and for this launch profile the command name is set a project this means the asp net core hosting model element value in this project file is completely ignored irrespective of the value that we have for this element in process or out of process if we run this project using this launch profile where command name is set a project our application will be always hosted out of process and only one web server is used and that is Castro and if you remember from our previous videos in this series with Kestrel the name of the process that hose and runs our application is dotnet dot exe and within the startup dot CS we have the code that displays the name of the process that hosts and runs our asp.net core project so if I run our project right now from visual studio using this employee management launch profile where the command name is set a project then the process name should be dotnet there we go notice the process name is dotnet now if we are running a race p.net core project using a launch profile where the command name is set to is Express and the a spinet cool hosting model element value is in process then only one web server is used and that is is xpress so in this case our SP dotnet code project will be hosted inside at the IAS express worker process which is is Express dot exe let's prove this now first let's stop our project in the drop down list here let's select IAS Express as the launch profile and notice for this profile the command name is pious Express and within our project file s banette co-hosting model has a value of in-process so when we run this project now from visual studio using this is X plus profile then this project should be hosted inside is Express worker process which is is X plus dot exe and that's what should be displayed in the browser there we go now if we said the SP nightcore hosting model element two out of process then kestrel is used as the internal web server and is express is used as the external web server in this case is Express is just a reverse proxy facing the internet taking the incoming HTTP request and forwarding it to kestrel it's the kestrel server that hosts and runs our asp.net core project in case of kestrel the process that hosts our application is dotnet dot exe so if we run our project with these settings in place the process name that is displayed in the browser must be dotnet let's prove this first let's stop the project we already have the IAS Express launch profile is selected in the project file let's change the setting to out of process and run our project there we go notice the process name is dotnet similarly if the command name is IAS and the esplanade co-hosting model element value is in process then our application is hosted using only one web server and that is is and if the esplanade core hosting model element value is out of process then kestrel is used as internal web server and is is used as the external web server that is as a reverse proxy server we'll discuss deploying our asp.net core application to IAS in our upcoming videos we can change the settings in launch settings store JSON file directly by editing this file or we can do that by using the graphical user interface provided by Visual Studio to access the graphical user interface right click on the project and select properties on the properties window click on the debug tab and in the drop down list right here we see both the profiles select the profile that you want to change that's it in this video thanks for watching you
Info
Channel: kudvenkat
Views: 223,082
Rating: undefined out of 5
Keywords: asp.net core launch settings, asp.net core launch url, asp.net core launch profile, asp.net core launch configuration, asp.net core launchsettings.json applicationurl, asp.net core launchsettings.json launchurl, visual studio profile asp.net core, launchsettings.json profiles, asp.net core launchsettings.json profiles
Id: u2S4TkkACVc
Channel Id: undefined
Length: 11min 35sec (695 seconds)
Published: Mon Jan 21 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.