Book Image

Practical Microservices with Dapr and .NET - Second Edition

By : Davide Bedin
Book Image

Practical Microservices with Dapr and .NET - Second Edition

By: Davide Bedin

Overview of this book

This second edition will help you get to grips with microservice architectures and how to manage application complexities with Dapr in no time. You'll understand how Dapr simplifies development while allowing you to work with multiple languages and platforms. Following a C# sample, you'll understand how Dapr's runtime, building blocks, and software development kits (SDKs) help you to simplify the creation of resilient and portable microservices. Dapr provides an event-driven runtime that supports the essential features you need for building microservices, including service invocation, state management, and publish/subscribe messaging. You'll explore all of those in addition to various other advanced features with this practical guide to learning Dapr. With a focus on deploying the Dapr sample application to an Azure Kubernetes Service cluster and to the Azure Container Apps serverless platform, you’ll see how to expose the Dapr application with NGINX, YARP, and Azure API Management. By the end of this book, you'll be able to write microservices easily by implementing industry best practices to solve problems related to distributed systems.
Table of Contents (20 chapters)
1
Part 1: Introduction to Dapr
5
Part 2: Building Microservices with Dapr
11
Part 3: Deploying and Scaling Dapr Solutions

Debugging a Dapr multi-project solution

In this section, we will configure debugging for multiple ASP.NET projects. In most cases, a .NET solution is developed in different projects, each representing a microservice or another component of the overall architecture. This is even more true in Dapr, which emphasizes and facilitates the development of microservices.

In this context, we leverage the VS Code capability to debug multiple projects at once. For more details, see the documentation at https://code.visualstudio.com/docs/editor/debugging#_multitarget-debugging.

When we previously needed to launch with only one project, we leveraged a scaffold task in the VS Code Dapr extension to add Dapr support in the launch.json and task.json files.

This time, we will create a new .NET project and include both in a solution. Afterward, we will manually edit the debug configuration files.

Creating .NET solutions

We previously provisioned our first .NET project. To test the multi...