Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Practical Serverless and Microservices with C#
Practical Serverless and Microservices with C#

Practical Serverless and Microservices with C#: Build resilient and secure microservices with the .NET stack and embrace serverless development in Azure

Arrow left icon
Profile Icon Gabriel Baptista Profile Icon Francesco Abbruzzese
Arrow right icon
€20.98 €29.99
eBook Jul 2025 472 pages 1st Edition
eBook
€20.98 €29.99
Paperback
€25.99 €37.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Gabriel Baptista Profile Icon Francesco Abbruzzese
Arrow right icon
€20.98 €29.99
eBook Jul 2025 472 pages 1st Edition
eBook
€20.98 €29.99
Paperback
€25.99 €37.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€20.98 €29.99
Paperback
€25.99 €37.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Practical Serverless and Microservices with C#

Demystifying Microservices Applications

Over the last decade, microservices architecture has taken a central role in modern software development. In this chapter, we will define what microservices architecture is. You will learn the reasons behind the success of microservices, their pros and cons, and when it is worth adopting them. Starting with the problems that led to their conception, we will discuss typical scenarios of when to use them, the impact of their adoption on overall project costs, and the returns you might expect.

You will get insights into the organization of microservices, discovering how it differs from the usual monolithic application by resembling more of an assembly line than user-requests-driven processing. This newly conceived organization brings with it new challenges that require ad hoc techniques to enforce coherence, coordination, and reliability.

Moreover, new patterns and best practices have been created to tackle challenges with microservices...

The rise of Service-Oriented Architectures (SOAs) and microservices

Briefly defined, microservices are chunks of software deployed on computer networks that communicate through network protocols. However, this is not all; they must also obey a set of further constraints.

Before giving a more detailed definition of what a microservices architecture is, we must understand how the idea of microservices evolved and what kind of problems it was called to solve. We will describe the two main steps of this evolution across two separate subsections.

The rise of SOA

The first step in the direction of microservices was taken by the so-called service-oriented architectures, or SOAs, that is, architectures based on networks of communicating processes. Initially, SOAs were implemented as web services similar to the ones you might have already experienced in ASP.NET Core.

In an SOA, different macro-modules that implement different features or roles in software applications are exposed...

The definition and organization of microservices architectures

In this section, we will give a definition of microservices and detail their immediate consequences on an organization, distinguishing between the microservices definition, which is expected to change gradually over time, and microservices practical organization, which might evolve at a faster rate as new technologies appear.

In the first subsection, we will focus on the definition and its immediate consequences.

A definition of microservices architectures

Let’s first list all the microservices requirements. Then, we will discuss each of them in a separate subsection.

A microservices architecture is an architecture based on SOA that satisfies all the constraints below:

  • Module boundaries are defined according to the domain of expertise they require. As we will discuss in the subsections below, this should ensure they are loosely coupled.
  • Each module is implemented as a replicable...

When is it worth adopting microservices architectures?

An application that requires more than five developers is certainly a good target for a microservices architecture since logical microservices help split the workforce into small, loosely coupled teams.

A high-traffic application with several time-consuming modules is also a good target for microservices architecture since it needs module-level performance optimizations.

Low-traffic applications that require just a small team of less than five people for their implementation are not a good target for a microservices architecture.

Deciding when to adopt microservices in all other situations that fall between the above extreme cases is not easy. In general, it requires a detailed analysis of costs and returns.

Considering costs, using a microservices architecture requires a development effort of about five times that of a usual monolithic application. We got this scale as an average on 7 total rewrites of monolithic...

Microservices common patterns

In this section, we will analyze the fundamental patterns used in all microservices architectures whose description is not tied to a specific programming language or tool. Most of them concern microservice communication. Let’s start with common retry strategies.

Resilient task execution

Microservices can be moved from one machine to another to achieve better load balancing. They can also be restarted to reset some possible memory leaks or to solve other performance issues. During these operations, they may miss some messages sent to them, or they may abort some ongoing computation. Moreover, failure due to software bugs or hardware faults may occur, too.

Since microservices architectures are required to be reliable (almost zero downtime), they are usually redundant, and particular care is needed to detect faults and apply corrective actions. Therefore, all microservices architectures must provide mechanisms to both detect failures,...

Summary

In this chapter, we described the basics of microservices, starting from their evolution and continuing on to their definition, organization, and main patterns.

We described the main features and requirements of a microservices-based application, how its organization resembles more of an assembly line than a user-requests-driven application, how to make microservices reliable, and how to handle efficaciously both failures and all problems caused by efficient asynchronous communication.

Finally, we described how to make all microservices more independent from each other with publisher-subscriber-based communication and how to interface a microservices application with the external word.

The next chapter describes two important building blocks for building enterprise-level microservices: Docker and Onion architectures.

Questions

  1. What is the main difference between a hold-style SOA and a modern microservices architecture?

In Microservices architectures are fine-grained. Moreover, each Microservices must not depend on the design choices of other Microservices. Furthermore, microservices must be redundant, replicable, and resilient.

  1. Why are loosely coupled teams so important?

Because it is quite easy to coordinate loosely coupled teams.

  1. Why must each logical microservice have dedicated storage?

This is an immediate consequence of the independence of the design choices of a Microservice from the design choices adopted in all other Microservices. In fact, sharing a common database would force common design choices on the database structure.

  1. Why is data-driven communication needed?

This is the only way to avoid long chains of recursive request and answers that would cause unacceptable overall response times.

  1. Why is...

Further reading

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Work through common scenarios encountered when developing distributed microservices applications
  • Understand cost considerations, traffic limits, and time limits surrounding serverless environments
  • Take full advantage of the synergy between Azure services (Container Apps, Functions, and Aspire) and .NET code
  • Purchase of the print or Kindle book includes a free eBook in PDF format

Description

From the authors of the Software Architecture with C# and .NET series comes this practical and grounded showcase of microservices using the .NET stack. Written for .NET developers entering the world of modern cloud and distributed applications, it shows you when microservices and serverless architectures are the right choice for building scalable enterprise solutions and when they’re not. You’ll gain a realistic understanding of their use cases and limitations. Rather than promoting microservices as a one-size-fits-all solution, it encourages thoughtful adoption based on real-world needs. Following a brief introduction and important setup, the book helps you prepare for practical application through examples such as a ride-sharing website. You’ll work with Docker, Kubernetes, Azure Container Apps, and the new .NET Aspire with considerations for security, observability, and cost management. The book culminates in a complete event-driven application that brings together everything you've covered. By the end of the book, you’ll have a well-rounded understanding of cloud and distributed .NET—viewed through the lens of two industry veterans.

Who is this book for?

This book is for engineers and senior software developers looking to advance into modern cloud and distributed applications. It helps professionals evolve their knowledge of microservices and serverless architecture to get the best of both architectural models. Prior experience with C#/.NET and the Microsoft Stack (Entity Framework and ASP.NET Core) is required to get the most out of this book. If you’ve enjoyed the authors’ previous Software Architecture with C# and .NET series, this new book offers an in-depth exploration of select topics in those earlier works.

What you will learn

  • Set up serverless environments in Azure for developing and debugging
  • Design reliable communication and computation across microservices
  • Explore Azure Functions in depth and use triggers for IoT and background tasks
  • Use Azure Container Apps to simplify the creation and management of containers
  • Apply best practices to secure a microservices application
  • Accurately assess and calculate costs and usage limits in serverless solutions

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jul 03, 2025
Length: 472 pages
Edition : 1st
Language : English
ISBN-13 : 9781836642008
Languages :
Concepts :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Jul 03, 2025
Length: 472 pages
Edition : 1st
Language : English
ISBN-13 : 9781836642008
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Table of Contents

14 Chapters
Demystifying Serverless Applications Chevron down icon Chevron up icon
Demystifying Microservices Applications Chevron down icon Chevron up icon
Setup and Theory: Docker and Onion Architecture Chevron down icon Chevron up icon
Azure Functions and Triggers Available Chevron down icon Chevron up icon
Background Functions in Practice Chevron down icon Chevron up icon
IoT Functions in Practice Chevron down icon Chevron up icon
Microservices in Practice Chevron down icon Chevron up icon
Practical Microservices Organization with Kubernetes Chevron down icon Chevron up icon
Simplifying Containers and Kubernetes: Azure Container Apps, and Othert Tools Chevron down icon Chevron up icon
Security and Observability for Serverless and Microservices Applications Chevron down icon Chevron up icon
The Car Sharing App Chevron down icon Chevron up icon
Simplifying Microservices with .NET Aspire Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.