In this article, we will go over how to install the Hangfire NuGet package within the NuGet Package Manager in Visual Studio. Then, we’ll walk through how to configure it within the .NET Core framework using Service Fabric. Lastly, we’ll learn how to use the BackgroundJob.Enqueue method in order to schedule a background task to be performed and at the same time not disturb the flow of your code.
JSON Web Token .NET Core Demo
In this post, I present a tiny .NET Core C# JWT API demo that creates and parses a JSON Web Token (JWT). A self-contained Swagger UI dashboard exercises the API.
We can’t dead-drop a JWT demo without wrapping it in words about JWT background. I’ll set the scene by introducing tokens, JWTs, and surveying session state residency tradeoffs. We’ll then migrate to, high-level JWT JWT use cases, and arguments about if or when to use JWTs.
I seek to give equal coverage to JWT upsides and downsides. Let’s get started.
Integrating Azure Functions with Cosmos DB SQL API in .NET Core 2.2
I am working on a project that leverages both Azure Functions as well as Cosmos DB. In trying to get both of these components wired together, I found that there are very few examples that work with the most recent versions of these components. I also saw examples that could work at a small scale, but don’t show industry-standard best practices, and would lead to performance issues if deployed in an environment with any meaningful traffic.
To that end, I put together this blog post showing how to set up an Azure Functions project in .NET Core 2.2 to integrate with Cosmos DB’s SQL API using its native tooling.
.NET Memory Management with dotMemory
Given the maturity of the .NET Framework and the automated nature of its memory management, many developers are guilty of glossing over (or even outright ignoring) whether their code is optimal in terms of CPU and memory usage. Personally, I have caught myself making sure my code is maintainable, testable, and extendable while forgetting to consider memory management in terms of nonfunctional aspects.
While the .NET runtime does a great job and memory corruption is extremely rare, we should still be concerned with memory management, particularly in large-scale .NET base applications.
This concern isn’t limited to on-premise applications. It’s easy to forget about memory usage with cloud computing. Azure Functions and AWS Lambda have billing structures based upon the average memory size per second of function execution. The direct correlation between memory usage and cost couldn’t be more transparent.
Fortunately, there are many great tools to help profile and analyze your memory footprint. JetBrains has a fantastic tool called dotMemory which makes it easy to profile processes, auto detect issues, perform deep analysis, and determine traffic. dotMemory can be installed as either a stand-alone tool or as a part of the ReSharper package integrated into Visual Studio.
In this post, we’ll show how to use dotMemory to generate a memory profile and analyze a memory leak in a .NET Core application.
Into the Core
The client I’m currently assisting has begun to move applications from more monolithic architecture into a more modern, cloud-based architecture. The organization is a bit of a .NET anomaly in that it is a company that’s primarily Java, yet has some .NET.
So even though Microsoft has a list of framework tools (such as Azure Service Fabric and Azure App Service), it’s fair to say that asking a primarily Java-focused company to use those tools could be an uphill battle. This is where .NET Standard and .NET Core have come to the rescue.
I work with a ton of smart people and I’m pretty amazed at how fast they can pick up on things from reading. I, however, cannot really understand it fully until I touch it. So let’s build a quick RESTful Web API step by step to see how challenging it is. We’ll be using .NET Standard, .NET Core, and ASP.NET Core.
- Page 1 of 2
- 1
- 2