How To Use HTTP CLIENT IN ASP NET CORE Applications | Getting Started With ASP.NET Core Series

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ก.ย. 2024
  • Hi Friends, The original and well-known HttpClient class can be easily used, but in some cases, it isn't being properly used by many developers. There are different issues that you can run into when instantiating and using the HttpClient class directly in your application code. You can run into multiple open connections, socket exhaustion, failure
    to handle underlying DNS changes, etc. To address all these issues, .NET Core has the IHttpClientFactory interface that can be used to
    configure and create HttpClient instances.
    In this video, I will walk you through the common mistakes that we run into when creating and managing HttpClient instances ourselves.
    I will show how you netstat to inspect the underlying socket connections that are opened when we create HttpClient instances and how the code we write affects it. I will then show you how to fix those using the IHttpClientFactory and the different consumption patterns
    available - Basic, Named, and Typed client instances.
    🔗Are You Using HttpClient in The Right Way? - www.rahulpnath...
    🔗HTTP Requests using IHttpClientFactory - docs.microsoft...
    🔗Issues with HttpClient - docs.microsoft...
    🔗Netstat - docs.microsoft...
    🔗Source Code - rahulpnath.vis...
    Additional Watching
    📹Configuration in ASP NET Core - • CONFIGURATION in ASP.N...
    📹Dependency Injection in ASP NET Core - • DEPENDENCY INJECTION i...
    📹ASP NET Core Series - • ASP.NET Core
    Come say hi! ✋
    🌍 Blog - rahulpnath.com/
    ✉ Subscribe to my Newsletter - www.rahulpnath...
    🐦Twitter - / rahulpnath
    📸Instagram - / rahulpnath
    🎥 Recording Setup and Workflow - www.rahulpnath...
    Make sure to SUBSCRIBE to the channel. THANK YOU for helping me grow this channel !!

ความคิดเห็น • 302

  • @manikchauhan6373
    @manikchauhan6373 หลายเดือนก่อน

    Hey mate… you have compressed all the knowledge in 20 minutes, a single source of truth .. bless you buddy

    • @RahulNath
      @RahulNath  หลายเดือนก่อน

      @@manikchauhan6373 Very happy to hear that Manik! Hope you are liking the ASP Net Series

  • @dailytech3785
    @dailytech3785 3 ปีที่แล้ว +6

    Rahul, i love the way you explain things simple clean and easy to remember.

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว +1

      Thank you and glad you like it!

  • @anandvijayan710
    @anandvijayan710 2 ปีที่แล้ว +8

    Simple, clean and clear. Thanks for the sharing your knowledge.

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      You are welcome Anand! Hope you are liking the full series bit.ly/asp-net-core-series

  • @DaniLearnsIT
    @DaniLearnsIT 13 วันที่ผ่านมา

    Daaaamn Rahul, no wonder you got the MVP title. That was super clear video. Any question that I started to have through the video, you answered it immediately. Thank you :)

    • @RahulNath
      @RahulNath  13 วันที่ผ่านมา

      Very happy to hear that Dani and glad you liked it! Do check out my ASP Series for more bit.ly/asp-net-core-series

  • @sruthivasudevan960
    @sruthivasudevan960 3 ปีที่แล้ว +4

    Can't thank you more, You are a savior.Thank you for teaching the concepts crystal clear.

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      Thank you Sruthi. Glad they are helping. Hope you are enjoying the full series and do let me know if you want any specific topics covered.

  • @herbertpaes2164
    @herbertpaes2164 2 ปีที่แล้ว +5

    Your content is very informative, easy to understand and goes directly to the point. Thank you very much for lending us your time to share this knowledge.

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      So nice of you Herbert and glad you found it useful. Do check out the full series here bit.ly/asp-net-core-series. I'm sure you will love them

  • @kumar_codes
    @kumar_codes 3 ปีที่แล้ว +3

    Awesome content....keep making videos like..this and make more ... I get more info and understand than any other tutorials/videos...

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      Thank you for the comment. It's encouraging 😀

  • @shaluatyagi8698
    @shaluatyagi8698 3 ปีที่แล้ว +2

    This is my first ever comment on TH-cam, as I could not resist to praise your efforts. Your videos are so clean and much better than any other professional paid course. I wish you all the very best and success from my heart.

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      Wow, thank you! Means a lot and happy you are liking these videos. Do let know if you have any topic suggestions.

    • @shaluatyagi8698
      @shaluatyagi8698 3 ปีที่แล้ว +1

      Can you please make videos on azure micro services!

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      @@shaluatyagi8698 Thank you for the suggestion. Sure yes, I am planning some content around that area!

    • @matthiasstahl6931
      @matthiasstahl6931 ปีที่แล้ว

      Same from my side!

  • @e-cogs
    @e-cogs 3 ปีที่แล้ว +2

    Nice video. Quick and invaluable information. Thank you for sharing.

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      Glad it was helpful! Do check out the other videos in this series th-cam.com/play/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP.html

  • @jeodazang
    @jeodazang ปีที่แล้ว

    Thank you for this video sir. This is the most informative video and tutorial that I have watched this week. Thank you for sharing this knowledge.

    • @RahulNath
      @RahulNath  ปีที่แล้ว

      Happy to hear that Jeorlie! Do check out my full series here bit.ly/asp-net-core-series

  • @RAKESHKUMAR-wv5qr
    @RAKESHKUMAR-wv5qr ปีที่แล้ว +1

    Simple, clean and clear. Thanks :)

    • @RahulNath
      @RahulNath  ปีที่แล้ว

      You're welcome Rakesh! Do check out the ASP Series bit.ly/asp-net-core-series

  • @touqeerhameed3435
    @touqeerhameed3435 ปีที่แล้ว +1

    very informative, easy to understand really

    • @RahulNath
      @RahulNath  ปีที่แล้ว

      Glad to hear that!

  • @gregorywilson2124
    @gregorywilson2124 2 ปีที่แล้ว +1

    These videos are really helpful, I didn't know about typed clients

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      Glad it was helpful Gregory. Do check out the full series here bit.ly/asp-net-core-series

  • @nirajdahal5019
    @nirajdahal5019 3 ปีที่แล้ว +2

    Very useful content. As most of the time in real world
    applications we use a lot of external API. :D

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      Thank you, Niraj!

  • @scabendlin
    @scabendlin 3 ปีที่แล้ว +1

    gud 1 rahul...wit such a poker face...lol

  • @manjeetlama9733
    @manjeetlama9733 2 ปีที่แล้ว

    This is the best explanation I have heard so far on Http Client. Thanks!!!

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      Glad it was helpful Manjeet! The full series is here bit.ly/asp-net-core-series

  • @matthiasstahl6931
    @matthiasstahl6931 ปีที่แล้ว

    Dear Mr. Nath,
    Thank you so much for sharing your knowledge in this easy and structured way. If more experts would explain their thoughts in this way, the world would be a better place.

    • @RahulNath
      @RahulNath  ปีที่แล้ว

      So nice of you Matthias. This comment has made my day and thank you for being a member and supporting me !

  • @sureshp34
    @sureshp34 2 ปีที่แล้ว

    Hi Rahul,
    This video is really very much helpful for the better understanding. Thanks a lot for posting the video.

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      You are most welcome Suresh! Do check out the full series for ASP NET - I'm sure you'll love it bit.ly/asp-net-core-series

  • @74himgup
    @74himgup 2 ปีที่แล้ว

    Hi Rahul, in an Interview today they asked me whether httpclient is singleton or scoped and if I have heard of socket issue. Both of the things you have explained beautifully here...Kudos !!! :)

    • @RahulNath
      @RahulNath  ปีที่แล้ว

      Glad it helped Himanshu. Hope you were able to successfully find a new job!

  • @Gioandgoose
    @Gioandgoose 2 ปีที่แล้ว

    Rahul Nath you are the man! Thank you sir!!

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      Thank you Gio! Glad this helped and also for supporting me here on the channel 🙂

  • @MNewful
    @MNewful 3 ปีที่แล้ว +2

    Awesome videos! Your videos are quick and easy to understand. Thank you so much.

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      Happy to hear that! Thank you 😀

  • @arjunanselvam
    @arjunanselvam หลายเดือนก่อน

    Thank you so much. All concepts you explain are very clear.

    • @RahulNath
      @RahulNath  หลายเดือนก่อน

      @@arjunanselvam Thank you very much Arjunan! Very happy to hear that and hope you are liking the whole Series.

  • @santiagotapia534
    @santiagotapia534 ปีที่แล้ว

    This is just perfect. There is a how and why and why not for each possibility. I would add a configuration setting for the base url.

    • @RahulNath
      @RahulNath  ปีที่แล้ว

      Glad you like it Santiago and yes I would add a configuration setting too. Wanted to keep the demo simple. Do check out the full series bit.ly/asp-net-core-series

  • @reallifegambits
    @reallifegambits 2 หลายเดือนก่อน

    Your channel is treasure for me, Thanks.

    • @RahulNath
      @RahulNath  2 หลายเดือนก่อน

      Very happy that you like it! Do check out the ASP Net Series bit.ly/asp-net-core-series
      Feel free to reach out if you have any questions or content suggestions.

  • @trickytechnology6749
    @trickytechnology6749 2 ปีที่แล้ว

    Hey Rahul,
    Providing complete and in-depth knowledge with solution makes YOU different form another youtubers. Immediately subscribed you and excited to learn more from you.

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว +1

      Welcome aboard and great to know it's helping! The full ASP NET Series is here in case you haven't seen bit.ly/asp-net-core-series

  • @AnjuU-db6pn
    @AnjuU-db6pn ปีที่แล้ว

    Came across your channel today and subscribed right away! Thanks for the clear explanation.

    • @RahulNath
      @RahulNath  ปีที่แล้ว

      Awesome, thank you Anju! You can check out the full series here bit.ly/asp-net-core-series

  • @kollus56
    @kollus56 2 ปีที่แล้ว +3

    I have recently subscribed to your channel and watching .net core videos . You have done great job teaching the concepts in very simple way and passed the knowledge step by step incrementally. Thanks for the videos .
    Do you have any full course on .net core ?

    • @kollus56
      @kollus56 2 ปีที่แล้ว

      Do you have any full .net core course ?

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว +1

      Thanks and welcome Seetharam! Glad you are liking it - I don't have a course as such but all my videos are in this playlist bit.ly/asp-net-core-series
      Feel free to drop in any specific topics/suggestions that you have.

    • @kollus56
      @kollus56 2 ปีที่แล้ว

      @@RahulNath I am watching them and really great help.

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว +1

      @@kollus56 Glad you are liking them! Do let me know if you have any topic suggestions.

  • @mahmoudzeort7078
    @mahmoudzeort7078 2 ปีที่แล้ว +1

    Great, in dept. and helpful explanation. Thank you a lot! Bravoooooo

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      Glad you enjoyed it Mahmoud!

  • @Potzakv20
    @Potzakv20 2 ปีที่แล้ว

    Love your videos, keep on going. With content like this, you are going to be huge!

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      Thanks, will do! glad these are helping

  • @norbertcsibi7720
    @norbertcsibi7720 3 ปีที่แล้ว +1

    Minute 10* What happens on concurrent API calls in our side? Which our API calls that weather forecast API, will they interfere since they r static? Any ideas of what would happen? Great Job Rahul! :)

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว +1

      Thank you Nobert. HttpClient is designed to work like that. It's the underlying handler that will handle this. There is also an associated property that sets the max connections available per server docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclienthandler.maxconnectionsperserver?view=net-5.0&WT.mc_id=AZ-MVP-5003875
      Let know if that helps

    • @norbertcsibi7720
      @norbertcsibi7720 3 ปีที่แล้ว

      @@RahulNath You`re a star ;)

  • @SagnikSaha94
    @SagnikSaha94 3 ปีที่แล้ว +1

    Very nicely explained 😊👍
    One small request, can you please prepare a video on how to secure ASP .Net core Web Api using AAD or any authentication mechanism.

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      Thanks Sagnik. Sure will do it some time soon!

  • @jasonld
    @jasonld ปีที่แล้ว +1

    Very helpful video. Thank you! I would love to know how to use an API Key and Secret to do a call.

    • @RahulNath
      @RahulNath  ปีที่แล้ว +1

      You would usually pass it as part of the HTTP Headers or however the API expects the keys to be. Do you have a scenario you are looking at?

  • @htowns5822
    @htowns5822 2 ปีที่แล้ว +1

    Thank You Rahul for the detailed tutorial ❣

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว +1

      Glad you liked it - Check out the full ASP Series bit.ly/asp-net-core-series. I'm sure you will like it

  • @nsajan
    @nsajan 3 ปีที่แล้ว +1

    Keep going Rahul. You are adding great content!! Question - if there are multiple typed clients talking to different end points, how many socket connections will get open? 1 or many?

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว +2

      Glad you are liking the videos! Yes it will create multiple connections since it will to a different endpoint/ip address. Also even for the same ip address it could create multiple connections depending on the timeout on the underlying HttpClientHandler instances. There are a few properties that you can set to control this behaviour too.
      docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclienthandler.maxconnectionsperserver?view=netcore-3.1&WT.mc_id=AZ-MVP-5003875
      Hope that helps.

  • @badrulhussain5545
    @badrulhussain5545 3 ปีที่แล้ว +1

    Wicked! you made this simple for me and thanks!

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      That's so nice to hear Badrul!

  • @milepetkovski6933
    @milepetkovski6933 2 ปีที่แล้ว +1

    Respect 👍

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว +1

      Thank you. Do check out the full series bit.ly/asp-net-core-series I am sure you will like it.

  • @divyanshusoni3448
    @divyanshusoni3448 2 ปีที่แล้ว

    Highly recommendable video

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      Glad you think so! Do check out the full series bit.ly/asp-net-core-series

  • @rennishj
    @rennishj 3 ปีที่แล้ว +1

    Thanks, nice explanation

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      You are welcome. Do check out the other videos in this series th-cam.com/play/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP.html

  • @banikhimu03
    @banikhimu03 3 ปีที่แล้ว

    Brilliant Rahul..every time I watch ur video I learn something new.

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      I am so happy to hear that. Thank you!

  • @anu608497
    @anu608497 6 หลายเดือนก่อน

    Thanks for the video Rahul. But it seems more like a school teaching. You can also include real world scenariors in this.

    • @RahulNath
      @RahulNath  6 หลายเดือนก่อน

      Glad you liked it - The idea is to understand the underlying principles of using HTTPClient well enough so that you can easily transfer that understanding to any real world application/scenario. Is there any particular context that you are looking where I can help adding in more details?

  • @MrTonyradford
    @MrTonyradford 2 ปีที่แล้ว +1

    This was helpful. Thanks.

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว +1

      Glad it was helpful Tony! More videos like this here in the ASP Series bit.ly/asp-net-core-series

    • @MrTonyradford
      @MrTonyradford 2 ปีที่แล้ว

      @@RahulNath Now that I can consume an api end point, the next step for me is to pass the response to a view, perhaps with some intermediate formatting and maybe using a model so as to bind the view. I think many people would find this useful as it's a real use case and I can't find much info on how to do this. One other dilemma - do you create an API project and add pages or create a Web App and add API functionality to it?

  • @prakash28nov
    @prakash28nov 2 ปีที่แล้ว

    Excellent Video

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      Thank you very much Prakash! The full ASP Series is here bit.ly/asp-net-core-series

  • @priyankabarde6503
    @priyankabarde6503 3 ปีที่แล้ว +1

    Hi Rahul.. Very useful and informative Will you do more vdo on .net core API.. Finally Supb yaar

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      Thank you Priyanka and happy you like the videos. DId you get a chance to check out my ASP Net Core API Series here th-cam.com/play/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP.html
      Do let know if you have any specific topics that you are looking for.

    • @priyankabarde6503
      @priyankabarde6503 3 ปีที่แล้ว +1

      @@RahulNath Yes I am going through Series.. Happy You read my comment :)

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      @@priyankabarde6503 Happy that these videos are helping and do let know if you have any questions or any other topic covered 😀

  • @partisanemo2079
    @partisanemo2079 2 ปีที่แล้ว

    One of the best tuts on ASP.NET! Dude, you're cool

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว +1

      Glad you like it - Here's the full series if you are interested bit.ly/asp-net-core-series

    • @partisanemo2079
      @partisanemo2079 2 ปีที่แล้ว

      @@RahulNath Thank you

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว +1

      @@partisanemo2079 do let me know your thoughts and suggestion if you get to watch any.

    • @partisanemo2079
      @partisanemo2079 2 ปีที่แล้ว

      ​@@RahulNath I am interested in configuration management for Blazor WebAssembly apps

  • @Azcraz
    @Azcraz 3 ปีที่แล้ว +1

    Amazing videos! You've helped me greatly on my enterprise application!

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      Happy to hear that! Do let know if there are specific topics that you are looking for

  • @thaliaquiroz8485
    @thaliaquiroz8485 2 ปีที่แล้ว +1

    Amazing video :')

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      Thank you Thalia!

  • @rathanveereddy9829
    @rathanveereddy9829 3 ปีที่แล้ว +1

    Useful content and great explanation. Keep it up. Thanks for the video.

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      Glad it was helpful!

  • @raki1190-y7i
    @raki1190-y7i 9 หลายเดือนก่อน

    This was a brilliant video, I like the way you take from beginner way of doing things to expert level, this way everyone can see where they are and what mistakes they are doing. I have a question.
    can httpclientfactory handle multiple/concurrent connections? if yes does it uses pool of sockets? in that case it may use multiple sockets based on the load? how this will scale in production use where 100's and 1000's of request can come simultaneously to the controller.

  • @melk48111
    @melk48111 2 ปีที่แล้ว

    Excellent

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      Thank you so much Melvis 😀 Do check out the full series here bit.ly/asp-net-core-series
      I am sure you will like it. Do let me know in case you get to watch it.

  • @techmantras6078
    @techmantras6078 2 ปีที่แล้ว

    Thank you! your content is very valuable and easy to understand , you opened my eyes, thanks for your efforts.

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      Happy to hear that! Hope you are enjoying the series bit.ly/asp-net-core-series

  • @FelipePereira-lx5jw
    @FelipePereira-lx5jw 2 ปีที่แล้ว

    Great video Rahul! thank you for share.

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว +1

      So nice of you! Do check the full series , I’m sure you’ll like it - th-cam.com/play/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP.html
      Do let know in case you get to watch it !

    • @FelipePereira-lx5jw
      @FelipePereira-lx5jw 2 ปีที่แล้ว

      ​@@RahulNath i'll watch!

  • @niravsoni2324
    @niravsoni2324 ปีที่แล้ว

    Well structured and nicely covered! Thanks Rahul!

    • @RahulNath
      @RahulNath  ปีที่แล้ว

      Glad you like it Nirav! Do check out the full series here bit.ly/asp-net-core-series

  • @rajusarmah4716
    @rajusarmah4716 2 ปีที่แล้ว

    Thanks a lot Rahul for this tutorial. It has always been informative to go through your videos.

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      Happy to hear that Raju! The full series is here th-cam.com/play/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP.html

  • @triyuga
    @triyuga 3 ปีที่แล้ว +2

    Wow!

  • @RAM-ff8dy
    @RAM-ff8dy 3 ปีที่แล้ว +1

    You always provide great content

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      Thanks Ram. Glad you are liking it!

  • @ramkumarramanathan3392
    @ramkumarramanathan3392 2 ปีที่แล้ว

    Great content

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว +1

      Glad you like it - Do check out the full series bit.ly/asp-net-core-series

  • @mannychohan
    @mannychohan 9 หลายเดือนก่อน

    Great tutorial Rahul.

    • @RahulNath
      @RahulNath  9 หลายเดือนก่อน

      Thank you Manny! Hope you are liking the series bit.ly/asp-net-core-series

  • @chazontour8588
    @chazontour8588 ปีที่แล้ว

    Great explanation 👌

    • @RahulNath
      @RahulNath  ปีที่แล้ว

      Glad you liked it! DO check out the full ASP Series bit.ly/asp-net-core-series

  • @klearner666
    @klearner666 2 ปีที่แล้ว

    I'm a beginner and I really liked your videos you got my sub.
    Keep spreading the knowledge :)

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว +1

      Welcome aboard and thank you Rupesh! The full series for ASP NET is here bit.ly/asp-net-core-series
      Do let know if you have any topic suggestions or feedback.

    • @klearner666
      @klearner666 2 ปีที่แล้ว

      @@RahulNath do you have any lessons where you can consume soap API and convert to rest and again rest to corresponding soap.?

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      @@klearner666 No I don't have any - what exactly are you trying to achieve by converting from and to SOAP?

  • @pardhasaradhivasamsetty7693
    @pardhasaradhivasamsetty7693 ปีที่แล้ว

    Thank you it helped me a lot. You are the best

    • @RahulNath
      @RahulNath  ปีที่แล้ว

      Glad it helped! Hope you are enjoying the series bit.ly/asp-net-core-series

  • @TechTalkWithMuke
    @TechTalkWithMuke 2 ปีที่แล้ว

    Rahul, This is simply perfect.

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      Thank you Mukeem! Do check out other videos in this series bit.ly/asp-net-core-series

  • @chetansn6
    @chetansn6 2 ปีที่แล้ว

    Hi Rahul, thanks for detailed explanation and much informative on each topic.
    I have one query form this video,
    Query : After creating WeatherService in this also still using HttpClient only right not HttpClirntFactory, how come registering this service in startup class will not have any disadvantages which we discussed at the earlier part of this video. If possible please answer this query.

    • @RahulNath
      @RahulNath  ปีที่แล้ว

      yes but the factory manages the instances and the underlying socket connections. Hope that helps you Chetan.

  • @harendrasinghrana
    @harendrasinghrana ปีที่แล้ว

    very helpful. Thanks for your efforts!

    • @RahulNath
      @RahulNath  ปีที่แล้ว

      Glad you like it. Do check out the full series here bit.ly/asp-net-core-series

  • @vikasjaiswal3729
    @vikasjaiswal3729 3 ปีที่แล้ว +1

    Thanks Rahul Nice Explaination

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      Glad you liked it Vikas!

  • @muratilgun5169
    @muratilgun5169 3 ปีที่แล้ว

    You are the best. Thank you Rahul!

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      Thank you Murat. Glad you are liking the series th-cam.com/play/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP.html

  • @TheDeckerFamily
    @TheDeckerFamily ปีที่แล้ว

    Thanks for the info, good stuff.

    • @RahulNath
      @RahulNath  ปีที่แล้ว

      Glad it was helpful Madison! Hope you are enjoying the full series bit.ly/asp-net-core-series

  • @jupiterblaze2961
    @jupiterblaze2961 2 ปีที่แล้ว

    Great video.

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      Glad you enjoyed it Jupiter! Do check out the full series here bit.ly/asp-net-core-series

  • @matheusgeorgo
    @matheusgeorgo 3 ปีที่แล้ว +1

    Hello Rahul, I appreciate the video, and I was wondering if you could make a follow-up but with Oath authentication. Thanks for the good explanation and example.

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว +1

      Thank you Sllan. Yes I am working on a series on authentication videos and they will be out soon.

  • @user-hx4mh5qs2v
    @user-hx4mh5qs2v 5 หลายเดือนก่อน

    Extrodinary!!!.

    • @RahulNath
      @RahulNath  5 หลายเดือนก่อน +1

      Thank you Kishore!! Do check out the ASP Series bit.ly/asp-net-core-series

  • @PradeepKumar-be4co
    @PradeepKumar-be4co 3 ปีที่แล้ว

    Good explanation and very useful. Nice work Rahul.

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      Glad it helped, thank you!

  • @ketannimbalkar6846
    @ketannimbalkar6846 3 ปีที่แล้ว

    Absolutely fantastic explanation

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      So happy to see this and glad it helped. Do check out the other videos in this series th-cam.com/play/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP.html

  • @heshamabdo6024
    @heshamabdo6024 3 ปีที่แล้ว +1

    Thank you so much

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      You're most welcome Hesham!

  • @thethomasproject
    @thethomasproject 3 ปีที่แล้ว

    Agree with other comments. Excellent video.

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      Thank you Frank! Glad you enjoyed it.

  • @RahulNath
    @RahulNath  3 ปีที่แล้ว

    Source Code - rahulpnath.visualstudio.com/DefaultCollection/TH-cam%20Samples/_git/MakingHttpRequest
    Related Blog Post - www.rahulpnath.com/blog/are_you_using_httpclient_in_the_right_way/

  • @shreyasjejurkar1233
    @shreyasjejurkar1233 3 ปีที่แล้ว +1

    This is quite great and helpful Rahul!

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว +1

      Happy it helped!

    • @shreyasjejurkar1233
      @shreyasjejurkar1233 3 ปีที่แล้ว

      @@RahulNath Please have a video on aspnetcore repo debugging thing that I told you on Twitter! Hope you remember! 😇

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      @@shreyasjejurkar1233 Sure yes, I have made a note of it and will do something on that soon.

    • @shreyasjejurkar1233
      @shreyasjejurkar1233 3 ปีที่แล้ว

      @@RahulNath Very Very Thanks! Looking forward to it.

  • @jackdaniel4936
    @jackdaniel4936 2 ปีที่แล้ว +1

    Hello Rahul. Great explanation. I have a question about HttpClient. When you using typed client, you are giving your interface and concrete in Startup with AddHttpClient() Extension Method and registering it. So i wonder what is the lifetime of my services when i use typed client and register my services with AddHttpClient method? It is adding my service as singleton to my ioc contanier? Or transient? I am asking this because when i only use services.AddHttpClient() (this is calling basic usage) i need to register my services separately. And i am free to choose lifetime in that way. But in typed clients, AddHttpClient method is registering our services for us and i want to learn what is the lifetime of my services when i use a typed client. Because i want to use typed client and set my IWeather service as singleton. But i am not sure what if it adds my service as Transient.
    Thank you, love your videos!

    • @jackdaniel4936
      @jackdaniel4936 2 ปีที่แล้ว +1

      Hello again, i am still confused about this situation. For example i did this but i dont know if this logic is true.
      services.AddHttpClient();
      services.AddSingleton();
      class MyService : IMyService
      {
      ctor()
      {
      inject IHttpClientFactory
      inject ILogger (default ILogger lifetime is singleton as i saw in documents)
      inject Another SingletonService..
      }
      public async Task MyMethod()
      {
      var client = httpClientFactory.CreateClient();
      var response = await client.GetAsync();
      //use other registered services...
      }
      }
      As you see, i can make singleton myservice in this way. I dont know my approach is true or not and i dont know i can do this with a typed client because a typed client is registered as transient and i dont want this.

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว +1

      Hey Jack, The typed client is registered as transient with DI container. docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests#how-to-use-typed-clients-with-ihttpclientfactory
      Hope that helps.

  • @salemnaser8441
    @salemnaser8441 2 ปีที่แล้ว

    Thanks for the sharing your knowledge.

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      Glad you liked it Salem. The full ASP NET Core series is here bit.ly/asp-net-core-series

  • @shashikiran5388
    @shashikiran5388 2 ปีที่แล้ว

    Excellent as usually. I like to have a topic from you regarding ASYNC AWAIT in WEBAPI. I know and worked on ASYNC & AWAIT but I have some gaps in understanding it. Is it possible for you to cover this topic in your style. Thanks Rahul.

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      Great suggestion Shashi! I will add this to my list and try and make a video. Happy you like these videos, The full ASP Series is here bit.ly/asp-net-core-series

  • @mohammadrafi8103
    @mohammadrafi8103 6 หลายเดือนก่อน +1

  • @bparitosh
    @bparitosh 2 ปีที่แล้ว +1

    Awesome tips. Thanks for sharing.
    Q) What is the issue in a singleton instance with DNS change, Could you please elaborate as the requestUri is injected during the GetAsync call. Thanks

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว +1

      You will need to write your own way to refresh the singleton instance in case of DNS changes etc or restart the application to have a new instance created. Using the factory handles all this for you. Hope that answers the question?

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว +1

      Do check out the full ASP Series here bit.ly/asp-net-core-series

    • @bparitosh
      @bparitosh 2 ปีที่แล้ว +1

      @@RahulNath Awesome videos and tips. Thanks for sharing

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      @@bparitosh Glad it helps!

  • @HenryTsang
    @HenryTsang ปีที่แล้ว

    Thank you again for an excellent explanation. Even though this is already 3 years old, information is still very valuable. By the way, I am wondering if you have any design thoughts on making a "generic" http handler? I google around, it seems complicated. If you have any insights, would greatly appreciate your teaching on it. Thank you.

  • @TheBdemba16
    @TheBdemba16 2 ปีที่แล้ว

    Great explanation. Any way you could make a video on how to create a nugget for API? Essentially if I have a simple API and want to turn this into some middleware, so that a client app can just install the nugget, register the service, inject it and be able to call the API endpoint that way.

  • @yondaimefourth
    @yondaimefourth 2 ปีที่แล้ว

    Damn! Now I can pass my technical exam. All I need to add is the Polly

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว +1

      Glad you liked it and wish you luck for the exam. For polly check out here th-cam.com/video/z6YcU0PW_9E/w-d-xo.html

    • @yondaimefourth
      @yondaimefourth 2 ปีที่แล้ว +1

      @@RahulNath great stuff! If I were to learn your aws course will it also prepare me for the associate developer certification?

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว +1

      @@yondaimefourth I haven't taken the associate developer certification myself so not sure of that. The Lambda course gives a good introduction to AWS Lambda and a few commonly used services when building Serverless applications. Currently, there is a discount on the course - details there on my latest giveaway video here th-cam.com/video/2eieEJAXmIk/w-d-xo.html
      I also have an AWS series here on this channel bit.ly/aws-net-series.
      Happy to help if you have additional questions.

    • @yondaimefourth
      @yondaimefourth 2 ปีที่แล้ว +1

      @@RahulNath great! Thanks mate

  • @FaizlMuhammed
    @FaizlMuhammed 2 ปีที่แล้ว

    Well Explained, thank you Rahul ...

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว +1

      Thank you Faizal!!

    • @FaizlMuhammed
      @FaizlMuhammed 2 ปีที่แล้ว

      @@RahulNath One doubt on Http client handling in dot net core can you please advise.
      Scenario: I have implemented http typed client. It seems the http object creating at every call instead of singleton and when running netstat -ano seems we have single port is opened (when tested with multiple calls) but after few hits or call(likely 1 minute after) it seems a new port is opened for API connection.
      Is the above scenario is normal with HTTP typed client.
      We are working in web API call as batch run configured with hight trafic.
      Do we have a new port will open after a certain time or certain number of hits. Can you please help with advise.

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      ​@@FaizlMuhammed This should be nomal - The underlying factory is pooling the connections as required. You can read more here docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests?WT.mc_id=AZ-MVP-5003875#httpclient-lifetimes
      Hope that helps

    • @FaizlMuhammed
      @FaizlMuhammed 2 ปีที่แล้ว +1

      @@RahulNath Thanks for the help Rahul. I am good now ☺️

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว +1

      @@FaizlMuhammed Feel free to reach out anytime!

  • @triyuga
    @triyuga 3 ปีที่แล้ว +1

    It would be cool if you publish your demos as public github repos...

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว +1

      Sorry missed posting the link in the comments. Here you go - rahulpnath.visualstudio.com/DefaultCollection/TH-cam%20Samples/_git/MakingHttpRequest.
      Thanks for pointing it out!

    • @triyuga
      @triyuga 3 ปีที่แล้ว

      @@RahulNath I used this today at work to hit the Australian Business Register.

  • @ruckmangadan
    @ruckmangadan ปีที่แล้ว +1

    👏

  • @preetichib2254
    @preetichib2254 2 ปีที่แล้ว

    Loved this video
    Thankyou! 😁

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      You're so welcome Preeti !

  • @luvrahooo
    @luvrahooo 2 ปีที่แล้ว +1

    Really awesome videos, could you please explain how to perform Post function like the way you did for Get from weather api. How to handle the json passed to the endpoint?

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว +1

      Glad you like it, Rahul. did you get a chance to see the Model Binding video - that explain in detail about it th-cam.com/video/bxksp575pk8/w-d-xo.html
      Also you can check out the full ASP Net Series here bit.ly/asp-net-core-series

    • @luvrahooo
      @luvrahooo 2 ปีที่แล้ว +1

      @@RahulNath yes I am going that video. Basically wanted to build webhook listener for tradingview webhook alerts and then process it for rest apis provided by brokers.

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      @@luvrahooo Prefect ok - let me know if you have additional questions and happy to help!

  • @heatherbeckman1767
    @heatherbeckman1767 2 ปีที่แล้ว

    Thank you! I subscribed.

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว +1

      Thank you Heather! Do check out the full series here bit.ly/asp-net-core-series. I'm sure you'll like it 🙂

  • @norbertcsibi7720
    @norbertcsibi7720 3 ปีที่แล้ว +1

    Minute 18:30* You are using HttpClient, however, why not sticky httpClientFactory? I use that, and when I create an httpClient of that typed method, the base URL is null :/

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      Using the HttpClientFactory comes under the Basic Usage pattern which is what I show at 12:15. Injecting in the IHttpClient directly is the next usage pattern, which helps clean up the code a bit more, since you don't have to do any of the CreateClient calls etc.When using the factory I believe you need to explicitly set the base URL like I show in the video. Also check the assoicated blog post here if that helps www.rahulpnath.com/blog/are-you-using-httpclient-in-the-right-way/
      Let know if that answers the question

  • @aktaruzzamansuman6264
    @aktaruzzamansuman6264 3 ปีที่แล้ว

    Nice tuts

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      Glad you like them! Do check out the full series here th-cam.com/play/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP.html

  • @abhaypatil7653
    @abhaypatil7653 3 ปีที่แล้ว

    Awesome 😎. Thanks Man 😁

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว +1

      Glad you like it Abhay. Do check out other videos in this series. th-cam.com/play/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP.html

  • @chaosinorderrr
    @chaosinorderrr 2 ปีที่แล้ว

    You mentioned that despite using the singleton approach, the connection still stays open as ESTABLISHED. However, in the IHttpClientFactory approach that is still the case. Shouldn't IHttpClientFactory have fixed this?

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      When using singleton it does not handle underlying network level changes etc. Which the factory does handle and recycle the instances. Does that answer the question? Do check out this doc link docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests?mvpaWT.mc_id=AZ-MVP-5003875

  • @sourabhchauhan6602
    @sourabhchauhan6602 3 ปีที่แล้ว

    Love it

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      Thank you, Sourabh! Do check out the full series bit.ly/asp-net-core-series

  • @balanatrayan
    @balanatrayan 3 ปีที่แล้ว +1

    Thank you Rahul! This is an excellent video. Quick question. I'm looking for a way to call the API for every 5 minutes. For ex: If I have to call this WeatherAPiI for every 5 mins, How would I do it? Do you have any suggestions?

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      Thank you Bala. I would consider Background Tasks first. you can check it out here th-cam.com/video/oWMQKjHrlJE/w-d-xo.html
      Let me know if that helps or if you have additional questions

    • @balanatrayan
      @balanatrayan 3 ปีที่แล้ว

      @@RahulNath Thank you Rahul! Your video on Background Tasks helped me to understand the BackgroundService concepts clearly. I was able to call the API for every 5 mins using the BackgroundService. I really appreciate your effort.

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      @@balanatrayan Great to know that and glad it helped 👍

  • @Chaostheory-88
    @Chaostheory-88 3 ปีที่แล้ว

    really cool explanation.. thanks

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      Glad you liked it Omar. Do check out the other videos in this series. I am sure you'll like them th-cam.com/play/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP.html
      Do let me know how it goes in case you do.

  • @PraveenSinghPapular
    @PraveenSinghPapular ปีที่แล้ว +1

    I am trying to call multiple APIs parallelly via Task.waitall with threshold using httpclient but in some scenarios getting Task cancelled error logged also getting can not access disposed object. Can you please brief why this is generated

    • @RahulNath
      @RahulNath  ปีที่แล้ว +1

      Is there a sample code you can share, so I can better understand the issue?

    • @PraveenSinghPapular
      @PraveenSinghPapular ปีที่แล้ว

      @@RahulNath how can I share please share mail-id

    • @RahulNath
      @RahulNath  ปีที่แล้ว

      @@PraveenSinghPapulardetails in about page - hello@rahulpnath.com

  • @mayureshs80
    @mayureshs80 3 ปีที่แล้ว +1

    Nice work! How would the DI look if there were multiple services each calling a different external HTTP endpoint? Would you keep on repeating the AddHttpClient call for each of those service ?

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว +1

      Thanks, Mayuresh.
      Yes, I do repeat the AddHttpClient multiple times. To make it cleaner you can write an extension method and use that in the Startup.cs (like below)
      _services.AddWeatherService();_
      Check out this commit for an example - bit.ly/httpclientextension
      Let know if that helps.

    • @mayureshs80
      @mayureshs80 3 ปีที่แล้ว

      @@RahulNath Thanks for the tip. That helps. This would make it possible to create a endpoint specific base service class as well and have every other service inherit from it.

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      With the base service class what properties are you trying to inherit? I generally try to avoid inheritance for code reuse

    • @mayureshs80
      @mayureshs80 3 ปีที่แล้ว

      @@RahulNath Probably just the endpoint property if there are multiple service classes using the same endpoint.

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      ​@@mayureshs80 Ok.

  • @SirajMSaha
    @SirajMSaha 3 ปีที่แล้ว

    Good job #Rahul

    • @RahulNath
      @RahulNath  3 ปีที่แล้ว

      Thank you Siraj!

  • @2011djdanny
    @2011djdanny 2 ปีที่แล้ว

    Great video, would be great if you can create a video on specflow testing a Rest API.

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว +1

      Glad you like it and thank you for the suggestion. I have a blog post here in case that helps you www.rahulpnath.com/blog/specflow-and-autofixture/

    • @2011djdanny
      @2011djdanny 2 ปีที่แล้ว

      @@RahulNath Genius, loved the post.

    • @RahulNath
      @RahulNath  2 ปีที่แล้ว

      @@2011djdanny Glad you did - I have a series on AutoFixture on this channel and also on my blog if you need to learn more about it. Feel free to reach out in case you have more questions.