Skip to main content

FromServices Attribute in ASP.NET Core

ASP.NET Core has inbuilt support for the dependency injection (DI) for adding the dependency to the container and then consume it in our application. Constructor injection is a familiar, and the most used way to inject the dependencies. However, it may not be an ideal choice in certain situations like only a single action method within the controller requires the dependency. ASP.NET Core provides an attribute called FromServices to inject the dependencies directly into the controller’s action method. In this post, we’ll find out how to use FromServices Attribute in ASP.NET Core. Read More

What’s coming in ASP.NET Core 2.2

Microsoft recently announced a roadmap for ASP.NET Core 2.2 putting the dates and things planned for the ASP.NET Core 2.2. The first preview will be out in August 2018 and RTM should be out before the end of the 2018. This release is not a major release compare to 2.0 and 2.1. This release will have a large tail of bug fixes, performance improvements, small features, and community PRs. This post provides a brief summary of what’s coming in ASP.NET Core 2.2. Read More

How to increase file upload size in ASP.NET Core

ASP.NET Core 2.0 enforces 30MB (~28.6 MiB) max request body size limit, be it Kestrel and HttpSys. Under normal circumstances, there is no need to increase the size of the HTTP request. But when you are trying to upload large files (> 30MB), there is a need to increase the default allowed limit. In this short post, we’ll see how to increase file upload size in ASP.NET Core application and various options to control this restriction. Read More

3 ways to use HTTPClientFactory in ASP.NET Core 2.1

Microsoft introduced the HttpClient in .Net Framework 4.5 and is the most popular way to consume a Web API in your .NET server-side code. But it has some serious issues like disposing the HttpClient object doesn’t close the socket immediately, too many instances affecting the performance and Singleton HttpClient or shared HttpClient instance not respecting the DNS Time to Live (TTL) settings. HttpClientFactory solves the all these problems. It is one of the newest feature of ASP.NET Core 2.1. It provides a central location for naming and configuring and consuming logical HttpClients in your application, and this post talks about 3 ways to use HTTPClientFactory in ASP.NET Core 2.1. Read More

Using jQuery with ASP.NET Core Blazor

If you are following the progress of Blazor, 0.3.0 is the latest version to play with (at the time of writing this post). I created a CRUD app using blazor 0.1, and since then things have changed a lot like syntax for event handling and data binding, async event handlers, better encapsulation of component parameters and many others. One of the most important and unnoticed change is, including references of any third-party JavaScript library like jQuery and placing the JavaScript code. This post talks about using jQuery with ASP.NET Core Blazor and what’s new in 0.3 regarding JavaScript code. Read More

.NET Core 3.0 announced: Welcome .NET Core for windows desktop applications

.NET Core 3.0 was announced yesterday at the Microsoft Build event and let’s welcome .NET Core supports for Windows Desktop applications. Finally, this is happening as developers were asking for desktop applications with .NET Core. The highlight of .NET Core 3 is support for Windows desktop applications, specifically Windows Forms, Windows Presentation Framework (WPF), and UWP XAML. You will be able to run new and existing Windows desktop applications on .NET Core and enjoy all the benefits that .NET Core has to offer. Read More