Microservices in .NET Core, Second Edition
Christian Horsdal Gammelgaard
  • MEAP began March 2020
  • Publication in November 2020 (estimated)
  • ISBN 9781617297922
  • 350 pages (estimated)
  • printed in black & white
free previous edition eBook included
An eBook copy of the previous edition of this book is included at no additional cost. It will be automatically added to your Manning Bookshelf within 24 hours of purchase.

I consider this to be a must-have in any microservice-enthusiasts library, be it .NET or not.

George Onofrei
Microservices in .NET Core, Second Edition is a comprehensive guide to building microservice applications using the .NET stack. After a crystal-clear introduction to the microservices architectural style, it teaches you practical microservices development skills using MVC Core and ASP.NET Core. This second edition of the bestselling original has been revised with up-to-date tools for the .NET ecosystem, and more new coverage of scoping microservices and deploying to Kubernetes.

About the Technology

Microservice applications are built by connecting single-capability, autonomous components that communicate via APIs. Microservice architectures boost productivity, support Agile workflows, and decrease the risks of catastrophic failures. However, they can be a big challenge to develop, as they demand clearly defined interfaces and reliable infrastructure. Luckily for developers, Microsoft’s own MVC Core and ASP.NET Core frameworks help manage the tricky API and simplify the task of building microservice-based applications.

About the book

Microservices in .NET Core, Second Edition provides a complete guide to building microservice applications. You’ll start by getting to grips with the unique architectural style of microservices, explained in a way that’s clear and accessible. You’ll move on quickly to practical development skills for building your own microservices using MVC Core and ASP.NET Core, working on real-world projects such as an ecommerce shopping cart. You'll design and build individual services in C# and learn how to compose them into a simple but functional application back end. In brand-new coverage for the second edition, you’ll also learn about scoping microservices and how to handle the complexities of deploying to Kubernetes. Along the way, you'll address production and operations concerns like monitoring, logging, and security.
Table of Contents detailed table of contents

Part 1: Getting Started with Microservices

1 Microservices at a glance

1.1 What is a microservice?

1.2 What is a microservices architecture?

1.2.1 Microservice characteristics

1.3 Why microservices?

1.3.1 Enabling continuous delivery

1.3.2 High level of maintainability

1.3.3 Robust and scalable

1.4 Costs and downsides of microservices

1.5 Greenfield vs. brownfield

1.6 Code reuse

1.7 Serving a user request: an example of how microservices work in concert

1.7.1 Main handling of the user request

1.7.2 Side effects of the user request

1.7.3 The complete picture

1.8 A .NET microservices technology stack

1.8.1 ASP.NET Core and MVC Core

1.8.2 Kubernetes

1.8.3 Setting up a development environment

1.9 A simple microservices example

1.9.1 Creating an empty ASP.NET Core application

1.9.2 Adding MVC Core to the project

1.9.3 Adding an MVC controller with an implementation of the endpoint

1.10 Summary

2 A basic shopping cart microservice

2.1 Overview of the Shopping Cart microservice

2.1.1 Components of the Shopping Cart microservice

2.2 Implementing the Shopping Cart microservice

2.2.1 Creating an empty project

2.2.2 The Shopping Cart microservice’s API for other services

2.2.3 Fetching product information

2.2.4 Parsing the product response

2.2.5 Adding a failure-handling policy

2.2.6 Implementing a basic event feed

2.3 Running the code

2.4 Summary

3 Deploying a microservice to Kubernetes

3.1 Why Kubernetes?

3.2 Putting the shopping cart microservice in a container

3.2.1 Add a Dockerfile to the Shopping Cart microservice

3.2.2 Build and run the shopping cart container

3.3 Running the shopping cart container in Kubernetes

3.3.1 Set up Kubernetes localhost

3.3.2 Create Kubernetes deployment for the shopping cart

3.4 Running the shopping cart container in Azure Kubernetes Service

3.4.1 Set up AKS

3.4.2 Run the shopping cart in AKS

3.5 Summary

Part 2: Building microservices

4 Identifying and scoping microservices

4.1 The primary driver for scoping microservices: business capabilities

4.1.1 What is a business capability?

4.1.2 Identifying business capabilities

4.1.3 Example: point-of-sale system

4.2 The secondary driver for scoping microservices: supporting technical capabilities

4.2.1 What is a technical capability?

4.2.2 Examples of supporting technical capabilities

4.2.3 Identifying technical capabilities

4.3 The tertiary driver for scoping microservices: supporting efficiency of work

4.4 What to do when the correct scope isn’t clear

4.4.1 Starting a bit bigger

4.4.2 Carving out new microservices from existing microservices

4.4.3 Planning to carve out new microservices later

4.5 Well-scoped microservices adhere to the microservice characteristics

4.5.1 Primarily scoping to business capabilities leads to good microservices

4.5.2 Secondarily scoping to supporting technical capabilities leads to good microservices

4.5.3 Tertiarily scoping to support efficiency of work

4.6 Summary

5 Microservices collaboration

5.1 Types of collaboration: commands, queries, and events

5.1.1 Commands and queries: synchronous collaboration

5.1.2 Events: asynchronous collaboration

5.1.3 Data formats

5.2 Implementing collaboration

5.2.1 Setting up a project for Loyalty Program

5.2.2 Implementing commands and queries

5.2.3 Implementing commands with HTTP POST or PUT

5.2.4 Implementing queries with HTTP GET

5.2.5 Implementing an event-based collaboration

5.2.6 Deploying to Kubernetes

5.2.7 Building a Docker container Special Offers microservice

5.2.8 Building a Docker container for both parts of Loyalty Program

5.2.9 Deploy the LoyalProgram API and the Special Offers

5.2.10 Deploy EventConsumer

5.3 Summary

6 Data ownership and data storage

6.1 Each microservice has a data store

6.2 Partitioning data between microservices

6.2.1 Rule 1: Ownership of data follows business capabilities

6.2.2 Rule 2: Replicate for speed and robustness

6.2.3 Where does a microservice store its data?

6.3 Implementing data storage in a microservice

6.3.1 Preparing a development setup

6.3.2 Storing data owned by a microservice

6.3.3 Storing events raised by a microservice

6.3.4 Setting cache headers in HTTP responses

6.3.5 Reading and using cache headers

6.4 Summary

7 Designing for robustness

7.1 Expect failures

7.1.1 Keeping good logs

7.1.2 Using correlation tokens

7.1.3 Rolling forward vs. rolling back

7.1.4 Don’t propagate failures

7.2 The client side’s responsibility for robustness

7.2.1 Robustness pattern: retry

7.2.2 Robustness pattern: circuit breaker

7.3 Implementing robustness patterns

7.3.1 Implementing a fast-paced retry strategy with Polly

7.3.2 Implementing a circuit breaker with Polly

7.3.3 Implementing a slow-paced retry strategy

7.3.4 Logging all unhandled exceptions

7.3.5 Deploying to Kubernetes

7.4 Summary

8 Writing tests for microservices

Part 3: Handling cross-cutting concerns: Building a reusable microservice platform

9 Introducing middleware: Writing and testing middleware

10 Cross-cutting: Monitoring and logging

11 Securing microservice-to-microservice communication

12 Building a reusable microservice platform

Part 4: Applications

13 Creating Applications over Microservices

What's inside

  • Build scalable microservices that are reliable in production
  • Optimized microservices for continuous delivery
  • Design event-based collaboration between microservices
  • Deploy microservices to Kubernetes
  • Set up Kubernetes in Azure

About the reader

This book is written for C# developers. No previous experience with microservices required.

About the author

Christian Horsdal is an independent consultant with 20 years of experience building systems from large scale microservice systems to tiny embedded systems--and lots of stuff in between. He is a .NET expert, author of the books Microservices in .NET Core and Instant Nancy Web Development, a trainer, and an occasional open source contributor.

placing your order...

Don't refresh or navigate away from the page.
Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.
print book $35.99 $59.99 pBook + eBook + liveBook
includes previous edition eBook
Additional shipping charges may apply
Microservices in .NET Core, Second Edition (print book) added to cart
continue shopping
go to cart

eBook $38.39 $47.99 3 formats + liveBook
includes previous edition eBook
Microservices in .NET Core, Second Edition (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.
customers also reading

This book 1-hop 2-hops 3-hops

FREE domestic shipping on three or more pBooks