Zum Hauptinhalt springen
Nicht aus der Schweiz? Besuchen Sie lehmanns.de

Practical Serverless and Microservices with C# (eBook)

Build resilient and secure microservices with the .NET stack and embrace serverless development in Azure
eBook Download: EPUB
2025
474 Seiten
Packt Publishing (Verlag)
978-1-83664-200-8 (ISBN)

Lese- und Medienproben

Practical Serverless and Microservices with C# - Gabriel Baptista, Francesco Abbruzzese
Systemvoraussetzungen
35,99 inkl. MwSt
(CHF 35,15)
Der eBook-Verkauf erfolgt durch die Lehmanns Media GmbH (Berlin) zum Preis in Euro inkl. MwSt.
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

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 this microservices book, you'll have a well-rounded understanding of cloud and distributed .NET-through the lens of two industry veterans.


Take a realistic look at microservices and distributed systems with the .NET stack to understand the limitations of microservices development through a practical lensFree with your book: DRM-free PDF version + access to Packt's next-gen Reader*Key FeaturesWork through common scenarios encountered when developing distributed microservices applicationsUnderstand cost considerations, traffic limits, and time limits surrounding serverless environmentsTake full advantage of the synergy between Azure services (Container Apps, Functions, and Aspire) and .NET codePurchase of the print or Kindle book includes a free eBook in PDF formatBook DescriptionFrom 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.What you will learnSet up serverless environments in Azure for developing and debuggingDesign reliable communication and computation across microservicesExplore Azure Functions in depth and use triggers for IoT and background tasksUse Azure Container Apps to simplify the creation and management of containersApply best practices to secure a microservices applicationAccurately assess and calculate costs and usage limits in serverless solutionsWho this book is forThis 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.]]>

1


Demystifying Serverless Applications


When it comes to software development, we are living in incredible times. With the evolution of cloud platforms and the rise of modern technologies, being a developer nowadays is both a wonderful way to live and a challenging profession to follow. There are so many ways to deliver an application and so many innovative technologies to explore that we may fall into a vicious circle where we focus more on the technologies rather than the actual solution.

This chapter aims to present the serverless architecture and explore how you can use this approach to implement a microservices application. To achieve this, it covers the theory behind serverless and provides an understanding of how it can be a viable alternative for microservices implementation.

The chapter also explores how Microsoft implements Function as a Service (FaaS), using Azure Functions as one of the options for building microservices. Two alternative development platforms will be presented: Visual Studio Code and Visual Studio.

By the end of this chapter, you will understand the different triggers available in Azure Functions and be ready to create your first function.

Technical requirements


This chapter requires Visual Studio 2022 free Community edition or Visual Studio Code. During the chapter, the details about how to debug Azure Functions for each development environment will be presented in the topics. You will also need an Azure account to create the sample environment. You can find the sample code for this chapter at https://github.com/PacktPublishing/Practical-Serverless-and-Microservices-with-Csharp.

What is serverless?


When someone asks you to develop a solution, the last thing they usually care about is how the infrastructure will work. The truth is, even for developers, the most important thing about infrastructure is that it simply works well.

Considering this reality, the possibility of having a cloud provider that dynamically manages server allocation and provisioning, leaving the underlying infrastructure to the provider, might be the best scenario.

That is what serverless architecture promises: a model we can use to build and run applications and services without having to manage the underlying infrastructure ourselves! This approach abstracts server management entirely, allowing developers to focus on their code.

The first cloud solution provider that presented this concept was Amazon, with the launch of AWS Lambda in 2014. After that, Microsoft and Google also provided similar solutions with Microsoft Azure Functions and Google Cloud Functions. As we mentioned before, the focus of this book will be Azure Functions.

There are many advantages that we can consider for using serverless computing. The fact that you do not have to worry about scaling can be considered the main one. Additionally, the cloud solution provider maintains the reliability and security of the environment. Besides that, with this approach, you have the option to pay as you go, so you only pay for what you use, enabling a sustainable model of growth.

Serverless can also be considered a good approach for accelerating software development since you only focus on the code needed to deliver that program. On the other hand, you may have difficulty overseeing a considerable number of functions, so this organization needs to be well handed to not cause problems while creating a solution with many functions.

Since the introduction of serverless, various kinds of functions have been created. These functions act as triggers that are used to start processing. As soon as the function is triggered, the execution can be done in different programming languages.

Now, let us check whether functions can be considered microservices or not.

Is serverless a way to deliver microservices?


If you look at the definition of microservices, you will find the concept of delivering an application as loosely coupled components that represent the implementation of a business capability. You can build something like that with a couple of functions, so yes, serverless is a way to deliver microservices.

Some specialists even consider serverless architecture an evolution of microservices, since the focus of serverless architecture is to deliver scalability in a safe environment, enabling the possibility of a set of functions to independently be developed, tested, and deployed, which brings a lot of flexibility to the software architecture. That is exactly the main philosophy of microservices.

Let us imagine, as an example, a microservice responsible for authenticating users. You may create specific functions for registering, logging, and resetting passwords. Considering that this set of functions can be created in a single serverless project, you have both the flexibility of creating separated functions and the possibility of defining the purpose of the microservice.

The serverless project will naturally support integration with databases, messaging queues, OpenAPI specifications, and other APIs, enabling the design patterns typically needed for a robust microservice architecture. It is also important to mention that keeping microservices isolated, small, and preferably reusable is a best practice worth following.

Now that you understand that you can write microservices using serverless approaches, let us understand how Microsoft Azure presents serverless in its platform.

How does Microsoft Azure present serverless?


In 2016, Microsoft introduced Azure Functions as a Platform-as-a-Service (PaaS) offering designed to deliver FaaS capabilities. This option enables innovation at a scale for business transformation. Today, Azure Functions gives us the opportunity to power up applications using multiple programming languages, including C#, JavaScript, F#, Java, and Python.

One of the standout features of Azure Functions is its seamless integration with other Azure services and third-party APIs. For instance, it can easily connect to different Azure databases (from Azure SQL Server to Azure Cosmos DB), Azure Event Grid for event-based architecture, and Azure Logic Apps for workflow automation. This connectivity simplifies the process of building complex, enterprise-grade applications that leverage multiple services.

Over the years, the possibilities with Azure Functions have evolved. Today, we can even manage stateful workflows and long-running operations, using Azure Durable Functions. With this, you can orchestrate complex processes that can be executed in multiple function executions.

But Microsoft has not only created an environment for coding functions. They have also created a complete pipeline for developers, following the DevSecOps process that’s now widely discussed and used in enterprise solutions. Developers can use tools such as Azure Pipelines, GitHub Actions, and other CI/CD services to automate the deployment process. You can also monitor and diagnose events in these functions using Azure Monitor and Application Insights, which facilitate troubleshooting and optimization.

The PaaS solution also enables different setups to adjust scalability and security aspects. Depending on the hosting plan you decide to set, you can have different scaling opportunities, as you can check here:

  • Consumption plan: The basic and most cost-effective option to get started with Azure Functions. Ideal for event-driven workloads with automatic scaling.
  • Flex Consumption plan: Offers rapid, elastic scaling combined with support for private networking (VNet integration).
  • Dedicated plan (App Service plan): Suitable for long-running functions and scenarios requiring more predictable performance and resource allocation.
  • Azure Container Apps plan: A solid choice for microservices-based architectures that use multiple technology stacks or require greater flexibility.
  • Premium plan: Designed for high-performance scenarios with the ability to scale on demand, providing support for advanced features such as VNet, longer execution times, and pre-warmed instances.

In summary, Microsoft Azure delivers serverless FaaS through Azure Functions, offering a powerful, flexible, and scalable platform that enhances the development and deployment of serverless applications. By using Azure Functions, developers can build and maintain responsive, cost-effective solutions. Now, let us explore how to create an Azure function in the Azure portal.

Creating your first serverless app in Azure


There are not many steps for creating your first serverless app in Azure. You can do it in a straightforward process when using the Azure portal. Follow these steps to get started:

  1. Log in to the Azure portal. To do so, open your web browser and navigate to the Azure portal at https://portal.azure.com/. Sign in with your Azure account credentials.
  2. In the Azure portal, click on the Create a resource button located in the upper-left corner.

Figure 1.1: Creating a resource in the Azure portal

  1. In the Search services and marketplace window, search for Function App and select it from the search results. This service will also be presented in the Popular Azure services section.
  2. Click...

Erscheint lt. Verlag 3.7.2025
Sprache englisch
Themenwelt Mathematik / Informatik Informatik Programmiersprachen / -werkzeuge
Mathematik / Informatik Informatik Theorie / Studium
ISBN-10 1-83664-200-8 / 1836642008
ISBN-13 978-1-83664-200-8 / 9781836642008
Informationen gemäß Produktsicherheitsverordnung (GPSR)
Haben Sie eine Frage zum Produkt?
EPUBEPUB (Ohne DRM)

Digital Rights Management: ohne DRM
Dieses eBook enthält kein DRM oder Kopier­schutz. Eine Weiter­gabe an Dritte ist jedoch rechtlich nicht zulässig, weil Sie beim Kauf nur die Rechte an der persön­lichen Nutzung erwerben.

Dateiformat: EPUB (Electronic Publication)
EPUB ist ein offener Standard für eBooks und eignet sich besonders zur Darstellung von Belle­tristik und Sach­büchern. Der Fließ­text wird dynamisch an die Display- und Schrift­größe ange­passt. Auch für mobile Lese­geräte ist EPUB daher gut geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür die kostenlose Software Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür eine kostenlose App.
Geräteliste und zusätzliche Hinweise

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Apps programmieren für macOS, iOS, watchOS und tvOS

von Thomas Sillmann

eBook Download (2025)
Carl Hanser Verlag GmbH & Co. KG
CHF 40,95
Apps programmieren für macOS, iOS, watchOS und tvOS

von Thomas Sillmann

eBook Download (2025)
Carl Hanser Verlag GmbH & Co. KG
CHF 40,95