ENVIRONMENTS in ASP NET Core | Getting Started With ASP.NET Core Series
Vložit
- čas přidán 19. 06. 2024
- Hello Friend 👋, ASP.NET Core configures application behavior based on the runtime environment using an environment variable. Out of the box, the framework provides three values - Development, Staging, and Production. More can be added based on your needs.
In this video let's understand more about Environments in ASP NET Core, how it's set, and a few different scenarios where this is used. We will learn about the launchsettings.json file, how the Development environment is set using it. We will also learn how to override values in the file and how we can create custom environments. I will also show you how to use environment specific appsettings.json file and how it works internally.
00:00 - Introduction
01:31 - Development Environment
03:33 - launchsettings.json
06:15 - Setting Environment variables
13:30 - Startup Class and Environment
16:51 - App Settings and Environment
🔗Docs - docs.microsoft.com/en-us/aspn...
🔗Source - rahulpnath.visualstudio.com/D...
🔗WIndows Terminal - www.rahulpnath.com/blog/setti...
Additional Watching
📹LOGGING - • LOGGING in ASP.NET Cor...
📹 STARTUP CLASS - • THE STARTUP CLASS In A...
📹ASP NET Core Series - • ASP.NET Core
Come say hi! ✋
🌍 Blog - rahulpnath.com/
✉ Subscribe to my Newsletter - www.rahulpnath.com/subscribe
🐦Twitter - / rahulpnath
📸Instagram - / rahulpnath
🎥 Recording Setup and Workflow - www.rahulpnath.com/blog/youtu...
Make sure to SUBSCRIBE to the channel. THANK YOU for helping me grow this channel !! - Jak na to + styl
Thank you! very nice video!
Hi Rahul,
even without subtitles this video is very very clear and valuable.
U make me discover new things as always
Thank you Ivan for you constant motivation. It does really help me to keep going 😀 And happy you are finding the videos useful.
Very nice explanation bro. Thank you.
Glad it helped! Do check out the series for more videos bit.ly/asp-net-core-series
Congratulations, it is very comprehensive about the subject.
Glad you think so!
Very comprehensive video. What I can't figure out is how when using Azure Devops to deploy a solution, you can specify the environment for the target on premise machine.
The examples I have found are 1 adding an environment variable at the machine level (not preferred) or adding environmentVariable ASPNETCORE_ENVIRONMENT in the web config that is created from devops if you deploy to IIS. Haven't been able to figure out how to do this automatically yet but I'm working on it. If you have other suggestions would love to hear it.
Brilliant! Thanks Rahul.
Thank you Steve!!
very nice explanation.
Glad you liked it!
Great lesson series for asp.net core. I have learned all .net core topics here and which are very practical too. Make aome advance level topics as well.
Thabk u Rahul
Thank you Swapnil. Do drop in any topic suggestions if you have any!
I really like the clear explanations and code examples. I watch your videos on 1.25x or 1.5x speeds :D For me a little faster is better :D Subscribed!
Thank you 👍Good feedback on the pace, but glad that increasing the speed is working for you.
On that note this is the best chrome extension for me 😀chrome.google.com/webstore/detail/video-speed-controller/nffaoalbilbmmfgbnbgppjihopabppdk
Awesome video Rahul. Keep going
Thanks a ton Sanjay!
Another excellent video. Thank you. Do you have a video for a full web.api net core deployment?
Thank you Victor. I have a full series where I cover different DevOps scenarios here czcams.com/play/PL59L9XrzUa-m7AFDgjWuwm6exyCklc03U.html
Also in the latest video here I show a build/deploy pipeline setup relevant to Environment variables in case you missed it czcams.com/video/wTSu2aCoR7Y/video.html
Is that what you were looking for?
Hi Rahul, Hope you are doing great.
Well, First of all thanks for teaching us. Secondly i want know how the actual implementation is show to you when you navigate to "env.IsDevelopment()". when i do the same thing i just get the metadata file. I'm using Visual Studio 2019 currently.
Thank you ! This is a feature in Jetbrains Rider, one of the main reasons I use it for my videos. www.jetbrains.com/help/rider/Debugging_External_Code.html
Thank you, great lesson on the series, can you please post videos on docker and kubernetes in the future ?
Thank you for the suggestion. Anything in particular you are looking from Docker?
@@RahulNath Docker in context of micro services please
@@amineherizi4687 Thank you for clarifying. Sure will. Between have you come across this github.com/dotnet-architecture/eShopOnContainers#related-documentation-and-guidance
Thank you dear... We need a video to explain Kafka (message broker) with asp. Net core
Glad you like it and thank you for the suggestion. Added it to the list!
@@RahulNath thank you mester rahul
@@mohammedalbosifi3975 😀
Nice video! How do i archive the same behavior with azure Pipeline with multiple environment app settings?
Thank you. Please check out these two videos that shows this
czcams.com/video/eGcosoC43vI/video.html
czcams.com/video/OFr6Vkw0mq8/video.html
Let me know if that helps or if you have additional questions.
Hi Rahul, if launch settings json is not deployed how will the environment name be detected after deploying
Hi rahul
hope you are doing well mate in this lockdown!!
do you have any videos explaning deploying of an application into an public cloud domain ?
let me know
cheers
Hey Shaun, I am doing good. Hope you are doing well during the lockdown/covid too.! Stay safe.
I have a DevOps series that shows various deployment scenarios, mostly for Azure czcams.com/play/PL59L9XrzUa-m7AFDgjWuwm6exyCklc03U.html
Is that what you are after? Can you please provide more details if not?
i have two files appsettings.Development.json & appsettings.Production.json, i want to apply ef_core update-database according to environment development or production put command doesn't work
"dotnet ef database update -- --environment Production" always apply developmnet file
Based on the environment you can overrider the configuration values getting picked up. Highly recommend checking out the Configuration video czcams.com/video/5GlgHV_12-k/video.html
Also check out different ways you can manage configuration www.rahulpnath.com/blog/handling-application-configuration/
Let me know if that helps or if you have additional questions.
AKS
Not sure how soon that will be, I haven't worked much on it. So it will be a while later, but thank you for the suggestion
I just want to hide my API Keys... how do I do that... by default the appsettings get push to my git repository
I cover it in details in this blog post and associated videos www.rahulpnath.com/blog/handling-application-configuration/
Hope that helps.
@@RahulNath I want to hide db connection string and some other keys in production. I can't use any managed service like Azure key vault. So I'm thinking of keeping it as a System environment variable. Saving a single key value pair like this and read them in .Net is simple and straight forward. But when it comes to saving a nested value as a system env variable and reading it always gives me Null value. Do you have any idea what I'm doing wrong?
@@shauncs Is it the delimiter that you are using? Do you have an example on what's failing?
@@RahulNath Got it sorted by adding __ (double underscore). Thanks anyways
Micro services
Yes thank you for the reminder 😀 Working on some content ideas.