You are most welcome Abhishek. Do check out the full series here if you haven't already ruclips.net/p/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP And you can call me Rahul 😀
Thank you Zarifa. Hope you have checked out the full series ruclips.net/p/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP Do let know if you have any topic suggestions.
It's slightly changed places - In case you didn't find it already - docs.microsoft.com/en-us/aspnet/core/fundamentals/middleware/?view=aspnetcore-6.0&WT.mc_id=AZ-MVP-5003875 Does that help?
I love Command line since I used to be trained sysnet admin. Today as a developer on a VM I face terrible slowdowns with graphical tools. On a CLI I do the action in no time. I was not given a VS license for a while and I had to deal with .NET CLI. This is nice to know those options too. It may sound foolish but sometimes using dotnet CLI unlocked strange situations compiling through VS did not help. Less often it can be the other way around. Anyway I am here to learn about that error handling stuff. I just learnt there is a way to globally handle exceptions and that can be handy for a task I am given to setup logging. EDIT: After having watched the video it is not talking about what I heard about but that is very interesting.
Hi Rahul, Your Video contents are really useful and helpful with Realtime cases, It would be better if you could also use slides .So that we will understand some theory part as well. At the start of the videos you can show the Agenda, explanation of the concepts and at the last you can summarizes what are all the steps required or done to implement the logic.. Can you also provide a Video on Serilog,intergrate Serilog with AWS elastic search and Kibana.
Glad you like it Vineethkumar. And a great suggestion on the slides. I will post a poll on the channel to see the general opinion too. Slides will add in more effort on my side, but happy to do if a lot of people think it will be useful 😀 Added Serilog to my list. Hope you have watched my video on Logging ruclips.net/video/dxBlBltEDRs/видео.html Thank you again for the suggestion and the feedback!
So happy to hear that Mahmadhusen. Do check out the full series here if you haven't already ruclips.net/p/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP And you can call me Rahul 😀
Glad you like it Akshay. Do check out the other videos in this series ruclips.net/p/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP Let know in case you want any particular topics to be covered.
@@akshayanvekar8713 Sure yes. Coming up soon! Meanwhile do checkout my AutoFixture playlist ruclips.net/p/PL59L9XrzUa-mItWClbGuMEK5oQpU2onCq It's very helpful with writing tests.
Hi Rahul, Thanks a lot for to the point videos. I really appreciate the content and the way you teach. I am able to understand the concept with the way you explain it. Thanks!
Thank you for the love and glad you like it. Hope you checked out other videos in this series ruclips.net/p/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP Do let know if you have specific topics that needs to be covered.
I don’t have one specific to micro services. But I talk about this pattern in this video. Is that what you were looking for ? ruclips.net/video/z6YcU0PW_9E/видео.html
3 года назад
Thank you very much it was just what I needed to implement in my API and you made it very simple, thanks again!
Usually I have the path to the repo in the description. Missed uploading this one. Will see if I can find it and upload it again. All repos are usually here rahulpnath.visualstudio.com/RUclips%20Samples/_git/aspnet-startup
whats the difference with this error handling to the controller filter globalexception : options.Filters.Add(); or which is the best way?, thanks for your videos
@@ChandanKumar-es7bz Is this what you are looking for? ruclips.net/video/HVruBWuKnYw/видео.html www.rahulpnath.com/blog/dot-net-core-api-and-azure-ad-groups-based-access/
With Azure Function since the code is more isolated I would handle it within the function handler code. if there are a lot of functions, I might add a base class to handle API calls and implement common handling there. I do have couple of videos around Azure Functions www.rahulpnath.com/blog/getting-started-with-azure-functions/ www.rahulpnath.com/blog/dependency-injection-in-azure-functions/ Let me know if that answers your question or if you have additional questions.
Hi Rahul, Your Videos are really awesome, I would like to hear a solution for the exception in the Finally block, How can we handle these exceptions in the real project. Thanks in advance.
Thank you Madhu. When you are catching an Exception the code likely you are expecting for it in that case what would you want the code to do? If you can explain the scenario a bit more maybe I could help.
The official docs here has some good suggestions around that _"Prefer middleware for exception handling. Use exception filters only where error handling differs based on which action method is called. "_ Read more here 👉 docs.microsoft.com/en-us/aspnet/core/mvc/controllers/filters?view=aspnetcore-5.0#exception-filters Let me know if you have further questions.
But isn't wrapping await next(context) in the try catch the same as having try catch all over your controller actions? this would cause a performance hit across the application won't it?
Thank you for the feedback! I have been more cautious about this in my recent videos and making sure it does not block important parts! Hope you are enjoying the series bit.ly/asp-net-core-series
Thanks for the video. I have a question. What if I have multiple ExceptionHandlingDomains? (maybe I have a few different projects to handle different areas of the business in my app) How my ExceptionHandlingMiddleware is aware of what ExceptionHandlingDomain to use?
Might need more details. But the handler can be extended to switch case on any Exception Type. Check this gist (from a friend of mine) gist.github.com/ankitvijay/168c41f3abb3e817375be05e7b2e7083#file-2_exceptionhandler-cs for an example Is that what you were looking for? What issues are you particularly facing?
@@RahulNath I am not running into issues yet b I just started implementing error handling and I watched your video and I’d like to implement it. So let me give you more details. I have a multi layer project. I called ManagerXXX to a project that handle certains things in the app. I think you called it Domain project. You could also think my ManagerXXX like my services. So I want to create a custom ManagerXXXHandlingException for each of those projects I have. My question was how can I make my ExceptionHandlerMidleware to be smart to decide what type of exception to use. I know that if I just keep adding CATCH CATCH CATCH… for all the ones I have on each manager will work, but that seems to be odd. I was wondering if there is a pattern for this scenario.
Very useful video. Rahul, is there any way we could capture the managed errors as well? For example, if we want to perform a global cache reset if some managed if exceptions occurred. In our case, it is already captured by the library we are using.
Thanks for the Knowledge Share, I found it useful. I have a question - In ExceptionHandler Middleware, the catch blocks grows as many we have different Domain Exceptions, could you suggest on A better way to handle, as catch blocks grows with different domain exception classes? This is on the Interview Questions I have got, please suggest..
Thank you Harish. The ExceptionHandler implementation in this blog post covers once such option to clean up the long list ankitvijay.net/2021/04/21/consistent-error-handling/ Let know if something like that is what you are looking for.
@@keerthang5557 Thank you Keerthan for clarifying. I am guessing this is what you are referring to? docs.microsoft.com/en-us/aspnet/core/fundamentals/host/hosted-services?view=aspnetcore-5.0&tabs=visual-studio Great Suggestion. Yes, I will do one on that.
Hi@rahul....I have deployed dotnet3.1 project which have .msi setup...when I am deploying .msi is not getting triggered and the deployment fails saying website not found....Any suggestions 🙏Thanks in advance
Hey Sai, that is a broad question. Why are you using MSI to deploy a website? Where are you installing this to? Is this a MSI distributed for your clients?
@@RahulNath I am installing to the web app on azure.....Yes it is distributed....I am giving silent installation command on inline script post deployment which dint work and also bat command also failed.....Thanks for all the learning you are providing 🙏
Sure you can - but it becomes limiting. Having specific or categorized domain exceptions allows you to capture and handle for it at central handlers. This makes it more powerful. Also when you look at logs you can immediately filter out based on the type of exception. So my preference is generally to create specific exceptions, but nothing stopping you from doing new Exception("Message"). Hope that helps
@@RahulNath No particular reason. I just couldn't understand why transient, and what does the lifetime of a exception handling service even mean? I have my web api with a couple of services that just deal with basic crud operations involving a database, and scoped lifetime seemed like a good choice for those. So i thought the exception handling middleware service would be the same.
they make sense only if you need to keep context + state in the context of that scope. In this case it isn't required - Do check out my DI video ruclips.net/video/YR6HkvNBpX4/видео.html And other videos in this series bit.ly/asp-net-core-series
Thank you for the suggestion Balaji. Any specific topics you would like covered? (Not sure how soon I will do it though, since I've not been working much on MVC)
Certain Exceptions need additionally a code mining strategy and we can use the ctor/BaseTrace (Assembly.GetCallingAssembly().Getname().Name ) added to the middleware to deliver a multilevel ring trace on a circular queue available on production mode, to locate the path of code.
This is something I was looking for my project. Handling error from a centralised system will surely save a alot of development efforts. Just had one doubt Why did you make your domain exception class as abstract ? What if, we don't make it abstract?
Thank you Bhavya. It's optional to mark it as abstract. (22:25) Only if you want to make sure across the code base you want more specific exceptions to be created instead of using the base class always. Hope that helps.
Hey Rohan, You can very well return IActionResult. Check out the differences between those in this video where I talk about it in detail ruclips.net/video/O9ZQ0O9uJ2E/видео.html. Do let me know in case you have additional questions about this.
Hi Rahul, After seeing this video I got confused between Middleware and filters, could you please make a video on this difference and when to use Middleware and filters.
Does this help you Syam? learn.microsoft.com/en-us/aspnet/core/mvc/controllers/filters?view=aspnetcore-6.0&WT.mc_id=AZ-MVP-5003875#use-middleware-in-the-filter-pipeline And this SO post also explains it a bit more stackoverflow.com/questions/42582758/asp-net-core-middleware-vs-filters
Hi i have created an asp.net core web api and added custome middleware but its still throwing the exception before going to middleware catch block..do wee need exception filter to handle that?
I am good Rajesh and hope you are too. Thank you for reminding me on this, I do have some planned but haven't reached to it yet. Any cloud tech preferences for you on it, or are you ok if it's either Azure or AWS?
@@RahulNath - Thanks for reply. I am fine with Azure. I will wait for microservices videos.. Finally I like your videos and keep it up. It would help more peoples like me.
Great explanation. Rahul, can u sovle my problems, I am 60+ woman, so I find your speed of teaching somewhat faster. But definitely best. My problem is As follows I want to make an apl to be cobsumed by angular, it has entity, employee with contenment if address, so how to write put method so that data of employee and address get updated togather.
@@RahulNath Yes, I am able to pass the arguments, but I don't know how access those parameters in global ExceptionHandlingMiddleware class. I want to print the exception in the log in common place.
Thank you Nikitha for the feedback. The idea with these videos was to explain concepts from a known starting point. I figured the existing default template app was the best place for this. If not it's hard to set the right context to explain the different concepts from a fully setup project. I have tried to include as much real world concepts/problems you come across, but would definitely would have missed heaps. Anything in particular you are looking for or you feel missing?
@@RahulNath thank you for your response rahul but what i am saying is if you can apply the concepts in curd operations i think its helps a lot for freshers... That's way i am asking any way your vedio's helps me alot thank you rahul
This is good but model validation error are not caught in above solution. Just need code where we can caught exception and Model validation at same place so that api can return common response.
It was a lot easier with the previous .NET v4.x; We could do this out of the box : 1) return Request.CreateErrorResponse(HttpStatusCode.NotFound, message); 2) throw new HttpResponseException( Request.CreateErrorResponse( HttpStatusCode.NotFound, message) ); Can anyone show an example where the http Client Library (e.g. axios, fetch) can actually capture the status-code, and custom message thrown by the web-api DOT NET CORE BULLSHIT?
Not sure about all "Indians" Emre, I do that to start from familiar grounds to someone new to a concept. This helps teach more easily than starting from a big code base. Not sure if you watched past the project creation and had any suggestions on that. Thank you!
Awesome content, Thank you ! Can we have something like this in a method. Public int SaveEntity() { try { context.SaveChanges(); } catch(DbUpdateException exception) { throw new SomeDomainException(exception?.InnerException); } } and catch that "SomeDomainException" in middleware.
You will become the best teacher for .Net developers . Thanks for explaining thing in such a simple way
Thanks a ton Bhuvan. Hope you are enjoying the ASP Series bit.ly/asp-net-core-series
just wanted to say that this is an excellent video for explaining global error handling. Kudos to you sir.
Thank you Rishabh and glad you liked it! Hope you are liking the ASP Series bit.ly/asp-net-core-series
Great content, Quality presentation. Thanks for sharing
My pleasure! The full series for ASP NET is here in case you haven't come across them bit.ly/asp-net-core-series
Thank you so much sir for this beautiful explanation. This is such a complex topic but made it to look very easy 🙏.
You are most welcome Abhishek. Do check out the full series here if you haven't already ruclips.net/p/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP
And you can call me Rahul 😀
I find your videos incredibly helpful for someone like me who is getting started in .net core.. Keep up the good work 👍
Thank you Kumar . happy to hear that. Do let know if there are specific topics that you would like covered.
P
@@RahulNath p
Exceptional Video on handling Exception !! Thank you Rahul !!
Thank you 😀
Wonderful demonstration of the concepts. Thank you very much sir.
You are most welcome Adarsh!!
The best teacher ever
Thank you Zarifa. Hope you have checked out the full series ruclips.net/p/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP
Do let know if you have any topic suggestions.
Great !! I have watched your other videos also. keep rocking. Thanks for your efforts.
Thanks a ton, glad you like them!
Oh my God, you are rocking man!
Thank you very much for this beautiful video. This is what exactly I'm looking for.
Glad I could help! Do check out the full series here bit.ly/asp-net-core-series
Thank you Rahul to made this video. Very good explainaion.
Thanks and welcome Deepak!
Hey Rahul, Thanks for the video. Just want to ask that how to register middle ware in .net 6 as there is no Startup.cs file in this version. So ?
It's slightly changed places - In case you didn't find it already - docs.microsoft.com/en-us/aspnet/core/fundamentals/middleware/?view=aspnetcore-6.0&WT.mc_id=AZ-MVP-5003875
Does that help?
As usual, highly quality.
Glad you think so!
Thank you so much!!! Greetings and blessings from Perú! 👍 👍
Thank you too!
I love Command line since I used to be trained sysnet admin.
Today as a developer on a VM I face terrible slowdowns with graphical tools.
On a CLI I do the action in no time.
I was not given a VS license for a while and I had to deal with .NET CLI.
This is nice to know those options too.
It may sound foolish but sometimes using dotnet CLI unlocked strange situations compiling through VS did not help.
Less often it can be the other way around.
Anyway I am here to learn about that error handling stuff.
I just learnt there is a way to globally handle exceptions and that can be handy for a task I am given to setup logging.
EDIT:
After having watched the video it is not talking about what I heard about but that is very interesting.
You have really good quality content, Rahul. I was inspired from your content to create my own RUclips channel. Thanks a lot!
Wow that's so nice to hear. And super glad to know you started a RUclips channel. I will check out the videos there.
@@RahulNath My pleasure, Rahul.
Very well explained!
Glad you liked it Aaqib. Hope you are enjoying the series bit.ly/asp-net-core-series
Great video and explanation once again!
Thanks again!
nice one Rahul. Well explained.
Happy you like it Anurag! (Still working out the security related topics. Lots of reading to do 😀)
@@RahulNath I have also started reading, and have understood a lot of security related concepts.
Please take your time.
Great Explanation Rahul, Thankyou so much
Thank you Sirpa!
Great Explanation!
Glad it was helpful! Do check the full series bit.ly/asp-net-core-series I'm sure you will like it!
superb video I found on you tube
Thanks and welcome. The full series on ASP is here bit.ly/asp-net-core-series
@@RahulNath Thanks a ton you replied me. I will view this.
@@nirajchandrajoshi Sure Niraj. Let me know in case you have specific questions, suggestions or feedback
Hi Rahul, Your Video contents are really useful and helpful with Realtime cases, It would be better if you could also use slides .So that we will understand some theory part as well. At the start of the videos you can show the Agenda, explanation of the concepts and at the last you can summarizes what are all the steps required or done to implement the logic.. Can you also provide a Video on Serilog,intergrate Serilog with AWS elastic search and Kibana.
Glad you like it Vineethkumar. And a great suggestion on the slides. I will post a poll on the channel to see the general opinion too. Slides will add in more effort on my side, but happy to do if a lot of people think it will be useful 😀 Added Serilog to my list. Hope you have watched my video on Logging ruclips.net/video/dxBlBltEDRs/видео.html
Thank you again for the suggestion and the feedback!
Thanks a lot Rahul. You have made it very clear for me !
Most welcome Fahmi!
Thanks for the detailed explanation, keep doing more🎉
Sure and happy you liked it Akhil. Hope you are enjoying the series bit.ly/asp-net-core-series
Fantastic video as always Rahul. Plenty of detail that is explained in a clear but thorough way. Thanks for helping the developer community!
Great to hear that, thank you.
Great detailed video sir, thanks for sharing
So happy to hear that Mahmadhusen. Do check out the full series here if you haven't already ruclips.net/p/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP
And you can call me Rahul 😀
That's awesome 👍
Thank you Avinash! Hope you are liking the series 👍
You earned a subscriber. Nice explanation.
Glad you like it Akshay. Do check out the other videos in this series ruclips.net/p/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP
Let know in case you want any particular topics to be covered.
@@RahulNath Can you create a Unit Test tutorial for asp.net core
@@akshayanvekar8713 Sure yes. Coming up soon! Meanwhile do checkout my AutoFixture playlist ruclips.net/p/PL59L9XrzUa-mItWClbGuMEK5oQpU2onCq
It's very helpful with writing tests.
Hi Rahul,
Thanks a lot for to the point videos. I really appreciate the content and the way you teach. I am able to understand the concept with the way you explain it.
Thanks!
superb..
Thank you Rajesh!
Thanks a lot for the great video with clear explainations!!!!
You are welcome and glad you liked it Medoune! The full series for ASP is here bit.ly/asp-net-core-series
Damn bro your explanation is awesome, need more videos on aap.net core❤️❤️❤️ and you deserve more subscribes
Thank you for the love and glad you like it. Hope you checked out other videos in this series ruclips.net/p/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP
Do let know if you have specific topics that needs to be covered.
@@RahulNath Yes watching the whole series, preparing for an interview
@@RahulNath Yes, can you make detailed videos on both generic and non generic collections. More focused on hashmap and dictionary
Really helpful your information!! Thank U.
Glad they are helping Subrata!
Thank you sir for the great explanations :)
Most welcome! Do checkout the full playlist here bit.ly/asp-net-core-series
Great video
Glad you like it Ash! Do check out my other videos in this series 😀
keep it bro, its awesome!!
Thank you Mayuresh! Do check out the full series here ruclips.net/p/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP
Hi Rahul , great effort , thanks for your video.
Thanks and welcome Adhi. Happy New Year. Check out the full series here which has lot more such videos bit.ly/asp-net-core-series
@@RahulNath Thanks Rahul , your videos are always different and advanced
@@adhivenkatesh3431 Thank you Adhi and happy that you find them useful.
very nice tutorial
Thanks for watching Paniraj!
Amazing explanation thanks a lot Rahul. New subscriber here!
Glad you are liking the content.
I can see your MVP award in background....
Yeah it's there on the shelf behind me 😀
Hi Rahu Do you have microservices and Circuit Breaker Pattern vedio
I don’t have one specific to micro services. But I talk about this pattern in this video. Is that what you were looking for ?
ruclips.net/video/z6YcU0PW_9E/видео.html
Thank you very much it was just what I needed to implement in my API and you made it very simple, thanks again!
Glad it helped Joshué! Do check out my full series here bit.ly/asp-net-core-series
I'm sure you will like it!
It would be better if you can give download also for the shown projects ... Great video
Usually I have the path to the repo in the description. Missed uploading this one. Will see if I can find it and upload it again.
All repos are usually here rahulpnath.visualstudio.com/RUclips%20Samples/_git/aspnet-startup
whats the difference with this error handling to the controller filter globalexception : options.Filters.Add(); or which is the best way?, thanks for your videos
Hi Rahul. I have watched your videos recently and they are really good
Thank you Chandan. Happy they are helping. Here is the full ASP Series in case you missed it bit.ly/asp-net-core-series
@@RahulNath Thanks Rahul. Can you please make a video on role based authentication in web api using microsoft graph
@@ChandanKumar-es7bz Is this what you are looking for?
ruclips.net/video/HVruBWuKnYw/видео.html
www.rahulpnath.com/blog/dot-net-core-api-and-azure-ad-groups-based-access/
How do you implement this in an Azure function since the azure function has some work around? Can you explain ?thanks.
With Azure Function since the code is more isolated I would handle it within the function handler code. if there are a lot of functions, I might add a base class to handle API calls and implement common handling there. I do have couple of videos around Azure Functions
www.rahulpnath.com/blog/getting-started-with-azure-functions/
www.rahulpnath.com/blog/dependency-injection-in-azure-functions/
Let me know if that answers your question or if you have additional questions.
Hi Rahul, Your Videos are really awesome, I would like to hear a solution for the exception in the Finally block, How can we handle these exceptions in the real project. Thanks in advance.
Thank you Madhu. When you are catching an Exception the code likely you are expecting for it in that case what would you want the code to do? If you can explain the scenario a bit more maybe I could help.
Filters and Middleware. When should we use filters ? When should we use Middleware. ?
The official docs here has some good suggestions around that
_"Prefer middleware for exception handling. Use exception filters only where error handling differs based on which action method is called. "_
Read more here 👉 docs.microsoft.com/en-us/aspnet/core/mvc/controllers/filters?view=aspnetcore-5.0#exception-filters
Let me know if you have further questions.
But isn't wrapping await next(context) in the try catch the same as having try catch all over your controller actions? this would cause a performance hit across the application won't it?
Hi Rahul, I appreciate your presentation, have few doubts can we use Enum instead of Summaries Array?
One request, is to make your face circle small so it doesn't hide the code.
Thank you for the feedback! I have been more cautious about this in my recent videos and making sure it does not block important parts! Hope you are enjoying the series bit.ly/asp-net-core-series
As mostly I use mobile to watch while commuting, it becomes even harder but good that you are aware. 👍
@@aaronbcj Yup makes sense / let me know if you face the same problem in more recent videos! Thanks again for the feedback!
Thanks for the video. I have a question. What if I have multiple ExceptionHandlingDomains? (maybe I have a few different projects to handle different areas of the business in my app) How my ExceptionHandlingMiddleware is aware of what ExceptionHandlingDomain to use?
Might need more details. But the handler can be extended to switch case on any Exception Type. Check this gist (from a friend of mine) gist.github.com/ankitvijay/168c41f3abb3e817375be05e7b2e7083#file-2_exceptionhandler-cs for an example
Is that what you were looking for? What issues are you particularly facing?
@@RahulNath I am not running into issues yet b I just started implementing error handling and I watched your video and I’d like to implement it. So let me give you more details. I have a multi layer project. I called ManagerXXX to a project that handle certains things in the app. I think you called it Domain project. You could also think my ManagerXXX like my services. So I want to create a custom ManagerXXXHandlingException for each of those projects I have. My question was how can I make my ExceptionHandlerMidleware to be smart to decide what type of exception to use. I know that if I just keep adding CATCH CATCH CATCH… for all the ones I have on each manager will work, but that seems to be odd. I was wondering if there is a pattern for this scenario.
I just saw the gist in your link. I think there is something there that could work for me. I will take a look at it closer.
@@callegarip Sure ok. let me know how that goes and if you have additional questions.
@@RahulNath thank you very much. You are awesome!
Very useful video.
Rahul, is there any way we could capture the managed errors as well? For example, if we want to perform a global cache reset if some managed if exceptions occurred. In our case, it is already captured by the library we are using.
Thanks for the Knowledge Share, I found it useful. I have a question - In ExceptionHandler Middleware, the catch blocks grows as many we have different Domain Exceptions, could you suggest on A better way to handle, as catch blocks grows with different domain exception classes? This is on the Interview Questions I have got, please suggest..
Thank you Harish. The ExceptionHandler implementation in this blog post covers once such option to clean up the long list ankitvijay.net/2021/04/21/consistent-error-handling/
Let know if something like that is what you are looking for.
Hi sir, can you make a tutorial video on worker service?
Hey Keerthan, Which worker services are you referring to?
And you can call me Rahul 😀
@@RahulNath It's worker service in asp.net core ( Hosted services)
@@keerthang5557 Thank you Keerthan for clarifying. I am guessing this is what you are referring to? docs.microsoft.com/en-us/aspnet/core/fundamentals/host/hosted-services?view=aspnetcore-5.0&tabs=visual-studio
Great Suggestion. Yes, I will do one on that.
@@RahulNath Yes brother, that's the one
@@keerthang5557 Sure will do!
Hi@rahul....I have deployed dotnet3.1 project which have .msi setup...when I am deploying .msi is not getting triggered and the deployment fails saying website not found....Any suggestions 🙏Thanks in advance
Hey Sai, that is a broad question. Why are you using MSI to deploy a website? Where are you installing this to? Is this a MSI distributed for your clients?
@@RahulNath I am installing to the web app on azure.....Yes it is distributed....I am giving silent installation command on inline script post deployment which dint work and also bat command also failed.....Thanks for all the learning you are providing 🙏
Hi Bro. Thanks for this video. I have one doubt. Can we simply use throw new exception kinds inside the code ? Is that a proper way?
Sure you can - but it becomes limiting. Having specific or categorized domain exceptions allows you to capture and handle for it at central handlers. This makes it more powerful. Also when you look at logs you can immediately filter out based on the type of exception. So my preference is generally to create specific exceptions, but nothing stopping you from doing new Exception("Message"). Hope that helps
@@RahulNath Thanks bro. Continue doing Azure related stuffs with .Net core. And also do containerization
@@vinothrajendran858 Cool thanks
Hello Rahul, could you explain why the lifetime of a Exception Handling Service is transient and not scoped?
since there is no state to be managed in there. Any reason you are looking at why it needs to be scoped?
@@RahulNath No particular reason. I just couldn't understand why transient, and what does the lifetime of a exception handling service even mean? I have my web api with a couple of services that just deal with basic crud operations involving a database, and scoped lifetime seemed like a good choice for those. So i thought the exception handling middleware service would be the same.
they make sense only if you need to keep context + state in the context of that scope. In this case it isn't required - Do check out my DI video ruclips.net/video/YR6HkvNBpX4/видео.html
And other videos in this series bit.ly/asp-net-core-series
@@RahulNath Thank you very much for the response!
please take session for .net core MVC
Thank you for the suggestion Balaji. Any specific topics you would like covered? (Not sure how soon I will do it though, since I've not been working much on MVC)
@@RahulNath Thank You. can you take real time example for filters like Authorization Filter and , Exception Filter in .NET core
Certain Exceptions need additionally a code mining strategy and we can use the ctor/BaseTrace (Assembly.GetCallingAssembly().Getname().Name ) added to the middleware to deliver a multilevel ring trace on a circular queue available on production mode, to locate the path of code.
yes adding in more logs helps, I usually have a request id to correlate across all the messages.
@@RahulNath Design for a Pitstop of Diagnostics to achieve functionality, refer you to the book Art of Programming by Edgar Dijkstra.
@@ramashankar2750 Great will check it out!
This is something I was looking for my project. Handling error from a centralised system will surely save a alot of development efforts.
Just had one doubt
Why did you make your domain exception class as abstract ? What if, we don't make it abstract?
Thank you Bhavya. It's optional to mark it as abstract. (22:25) Only if you want to make sure across the code base you want more specific exceptions to be created instead of using the base class always. Hope that helps.
Is it mandatory to return concrete type if we are implementing our custom ExceptionMiddleware from action method or we can use IActionResult also ?
Hey Rohan, You can very well return IActionResult. Check out the differences between those in this video where I talk about it in detail ruclips.net/video/O9ZQ0O9uJ2E/видео.html. Do let me know in case you have additional questions about this.
Hi Rahul, After seeing this video I got confused between Middleware and filters, could you please make a video on this difference and when to use Middleware and filters.
Does this help you Syam? learn.microsoft.com/en-us/aspnet/core/mvc/controllers/filters?view=aspnetcore-6.0&WT.mc_id=AZ-MVP-5003875#use-middleware-in-the-filter-pipeline
And this SO post also explains it a bit more stackoverflow.com/questions/42582758/asp-net-core-middleware-vs-filters
Shower of love Rahul
Thank you Sahil! Do check out the full series if you haven't already bit.ly/asp-net-core-series
Hi i have created an asp.net core web api and added custome middleware but its still throwing the exception before going to middleware catch block..do wee need exception filter to handle that?
Yes I think so - hope you were able to catch that?
👍
😀
Why you use Rider not visual studio?
Because it is easier to navigate into library implementation code, like I do at 4:56
Hi Rahul, How are you? If you get a chance please do videos on .Net core microservices
I am good Rajesh and hope you are too. Thank you for reminding me on this, I do have some planned but haven't reached to it yet. Any cloud tech preferences for you on it, or are you ok if it's either Azure or AWS?
@@RahulNath - Thanks for reply. I am fine with Azure. I will wait for microservices videos.. Finally I like your videos and keep it up. It would help more peoples like me.
@@raagasongs Thank you !!
YOU ARE PERFECT
Haha definitely not, but thank you 😀 Hope you are enjoying the series bit.ly/asp-net-core-series
Great explanation. Rahul, can u sovle my problems, I am 60+ woman, so I find your speed of teaching somewhat faster. But definitely best. My problem is As follows
I want to make an apl to be cobsumed by angular, it has entity, employee with contenment if address, so how to write put method so that data of employee and address get updated togather.
Employee with id, name, salary and addressid as fireign key, with another entity address id, street, city, pin
Happy to help. What issues are you facing in particular?
You should tell us you are a 16yo girl, not 60+ woman ! Then everyone in here will jump to help you 😍😁😆🤣
Can u add more videos about aks
Thank you for the suggestion. Not sure how soon though, I havent been doing a lot of aks.
Great channel you have got yourself Chinju! And great to see you are from Kerala too (I am as well 😀)
Is it possible to pass multiple parameters to "DomainNotFoundException" class and access those parameters in ExceptionHandlingMiddleware class ?
Sure. Any number of parameters and types as you wish. it’s a custom type, so you can control it. let me know if you are running into any issues
@@RahulNath Yes, I am able to pass the arguments, but I don't know how access those parameters in global ExceptionHandlingMiddleware class. I want to print the exception in the log in common place.
how to handle 403 in .net core web api
great (y)
Thank you Usama 😀
Hi Rahul,
I would like you to post a new video on "CancellationToken" in HttpClient request.
Great suggestion Suresh. This is something on my list. I will try and do something on it.
Thank you@@RahulNath
Hai,rahul please explain the concepts in realtime examples.... don't use wheatherforcate for everytime
Thank you Nikitha for the feedback. The idea with these videos was to explain concepts from a known starting point. I figured the existing default template app was the best place for this. If not it's hard to set the right context to explain the different concepts from a fully setup project. I have tried to include as much real world concepts/problems you come across, but would definitely would have missed heaps. Anything in particular you are looking for or you feel missing?
@@RahulNath thank you for your response rahul but what i am saying is if you can apply the concepts in curd operations i think its helps a lot for freshers... That's way i am asking any way your vedio's helps me alot thank you rahul
@@NikithaGurram Sure will keep that in mind - Glad you find the videos useful Nikitha 👍
This is good but model validation error are not caught in above solution. Just need code where we can caught exception and Model validation at same place so that api can return common response.
Hope you were able to resolve this.
@@RahulNath I have not got solution
Rahul is just awesome guy from 2050
Haha !! Thank you and happy you liked it. Check out the full series here bit.ly/asp-net-core-series
It was a lot easier with the previous .NET v4.x; We could do this out of the box :
1) return Request.CreateErrorResponse(HttpStatusCode.NotFound, message);
2) throw new HttpResponseException( Request.CreateErrorResponse( HttpStatusCode.NotFound, message) );
Can anyone show an example where the http Client Library (e.g. axios, fetch) can actually capture the status-code, and custom message thrown by the web-api DOT NET CORE BULLSHIT?
triggered inaan hum aapse milne a rahe hain march mein
sorry, didn't understand?
Indians start explaining anything by first creating a project. You all.shall.see one more time how to create a project. And name it "my project".
Not sure about all "Indians" Emre, I do that to start from familiar grounds to someone new to a concept. This helps teach more easily than starting from a big code base. Not sure if you watched past the project creation and had any suggestions on that. Thank you!
Awesome content, Thank you !
Can we have something like this in a method.
Public int SaveEntity()
{
try
{
context.SaveChanges();
}
catch(DbUpdateException exception)
{
throw new SomeDomainException(exception?.InnerException);
}
}
and catch that "SomeDomainException" in middleware.
Yes, you could do that - nothing stopping you from doing that. It might soon be a lot of exceptions depending on the granularity of these classes.
@@RahulNath Thanks for the reply.
awesome video
Glad you enjoyed it and hope you are enjoying the full series bit.ly/asp-net-core-series