Microservices in .NET, Second Edition
Microservices in .NET, Second Edition teaches you to build and deploy microservices using ASP.NET and Azure services.

Summary
In Microservices in .NET, Second Edition you will learn how to:

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

Microservices in .NET, 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 ASP.NET. 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.

Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.

About the technology
Microservice architectures connect independent components that must work together as a system. Integrating new technologies like Docker and Kubernetes with Microsoft’s familiar ASP.NET framework and Azure cloud platform enables .NET developers to create and manage microservices efficiently.

About the book
Microservices in .NET, Second Edition teaches you to build and deploy microservices using ASP.NET and Azure services. It lays out microservice architecture simply, and then guides you through several real-world projects, such as building an ecommerce shopping cart. In this fully revised edition, you’ll learn about scoping microservices, deploying to Kubernetes, and operations concerns like monitoring, logging, and security.

What's inside

Optimize microservices for continuous delivery
Design event-based collaboration between microservices
Deploy microservices to Kubernetes
Set up Kubernetes in Azure

About the reader
For C# developers. No experience with microservices required.

About the author
Christian Horsdal is an independent consultant with more than 20 years of experience building projects from large-scale microservice systems to tiny embedded systems.

Table of Contents
PART 1 GETTING STARTED WITH MICROSERVICES
1 Microservices at a glance
2 A basic shopping cart microservice
3 Deploying a microservice to Kubernetes
PART 2 BUILDING MICROSERVICES
4 Identifying and scoping microservices
5 Microservice collaboration
6 Data ownership and data storage
7 Designing for robustness
8 Writing tests for microservices
PART 3 HANDLING CROSS-CUTTING CONCERNS: BUILDING A REUSABLE MICROSERVICE PLATFORM
9 Cross-cutting concerns: Monitoring and logging
10 Securing microservice-to-microservice communication
11 Building a reusable microservice platform
PART 4 BUILDING APPLICATIONS
12 Creating applications over microservices
1139747268
Microservices in .NET, Second Edition
Microservices in .NET, Second Edition teaches you to build and deploy microservices using ASP.NET and Azure services.

Summary
In Microservices in .NET, Second Edition you will learn how to:

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

Microservices in .NET, 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 ASP.NET. 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.

Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.

About the technology
Microservice architectures connect independent components that must work together as a system. Integrating new technologies like Docker and Kubernetes with Microsoft’s familiar ASP.NET framework and Azure cloud platform enables .NET developers to create and manage microservices efficiently.

About the book
Microservices in .NET, Second Edition teaches you to build and deploy microservices using ASP.NET and Azure services. It lays out microservice architecture simply, and then guides you through several real-world projects, such as building an ecommerce shopping cart. In this fully revised edition, you’ll learn about scoping microservices, deploying to Kubernetes, and operations concerns like monitoring, logging, and security.

What's inside

Optimize microservices for continuous delivery
Design event-based collaboration between microservices
Deploy microservices to Kubernetes
Set up Kubernetes in Azure

About the reader
For C# developers. No experience with microservices required.

About the author
Christian Horsdal is an independent consultant with more than 20 years of experience building projects from large-scale microservice systems to tiny embedded systems.

Table of Contents
PART 1 GETTING STARTED WITH MICROSERVICES
1 Microservices at a glance
2 A basic shopping cart microservice
3 Deploying a microservice to Kubernetes
PART 2 BUILDING MICROSERVICES
4 Identifying and scoping microservices
5 Microservice collaboration
6 Data ownership and data storage
7 Designing for robustness
8 Writing tests for microservices
PART 3 HANDLING CROSS-CUTTING CONCERNS: BUILDING A REUSABLE MICROSERVICE PLATFORM
9 Cross-cutting concerns: Monitoring and logging
10 Securing microservice-to-microservice communication
11 Building a reusable microservice platform
PART 4 BUILDING APPLICATIONS
12 Creating applications over microservices
59.99 In Stock
Microservices in .NET, Second Edition

Microservices in .NET, Second Edition

by Christian Horsdal Gammelgaard
Microservices in .NET, Second Edition

Microservices in .NET, Second Edition

by Christian Horsdal Gammelgaard

Paperback(2nd ed.)

$59.99 
  • SHIP THIS ITEM
    In stock. Ships in 2-4 days.
  • PICK UP IN STORE

    Your local store may have stock of this item.

Related collections and offers


Overview

Microservices in .NET, Second Edition teaches you to build and deploy microservices using ASP.NET and Azure services.

Summary
In Microservices in .NET, Second Edition you will learn how to:

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

Microservices in .NET, 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 ASP.NET. 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.

Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.

About the technology
Microservice architectures connect independent components that must work together as a system. Integrating new technologies like Docker and Kubernetes with Microsoft’s familiar ASP.NET framework and Azure cloud platform enables .NET developers to create and manage microservices efficiently.

About the book
Microservices in .NET, Second Edition teaches you to build and deploy microservices using ASP.NET and Azure services. It lays out microservice architecture simply, and then guides you through several real-world projects, such as building an ecommerce shopping cart. In this fully revised edition, you’ll learn about scoping microservices, deploying to Kubernetes, and operations concerns like monitoring, logging, and security.

What's inside

Optimize microservices for continuous delivery
Design event-based collaboration between microservices
Deploy microservices to Kubernetes
Set up Kubernetes in Azure

About the reader
For C# developers. No experience with microservices required.

About the author
Christian Horsdal is an independent consultant with more than 20 years of experience building projects from large-scale microservice systems to tiny embedded systems.

Table of Contents
PART 1 GETTING STARTED WITH MICROSERVICES
1 Microservices at a glance
2 A basic shopping cart microservice
3 Deploying a microservice to Kubernetes
PART 2 BUILDING MICROSERVICES
4 Identifying and scoping microservices
5 Microservice collaboration
6 Data ownership and data storage
7 Designing for robustness
8 Writing tests for microservices
PART 3 HANDLING CROSS-CUTTING CONCERNS: BUILDING A REUSABLE MICROSERVICE PLATFORM
9 Cross-cutting concerns: Monitoring and logging
10 Securing microservice-to-microservice communication
11 Building a reusable microservice platform
PART 4 BUILDING APPLICATIONS
12 Creating applications over microservices

Product Details

ISBN-13: 9781617297922
Publisher: Manning
Publication date: 11/23/2021
Edition description: 2nd ed.
Pages: 328
Product dimensions: 7.38(w) x 9.25(h) x 0.80(d)

About the Author

Christian Horsdal Gammelgaard 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.

Table of Contents

Preface xiii

Acknowledgments xiv

About this book xv

About the author xviii

About the cover illustration xix

Part 1 Getting Started with Microservices 1

1 Microservices at a glance 3

1.1 What is a microservice? 3

1.2 What is a microservices architecture? 5

Microservice characteristics 6

1.3 Why microservices? 11

Enabling continuous delivery 11

High level of maintainability 13

Robust and scalable 14

1.4 Costs and downsides of microservices 14

1.5 Greenfield vs. brownfield 15

1.6 Code reuse 16

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

Main handling of the user request 17

Side effects of the user request 19

The complete picture 20

1.8 A .NET microservices technology stack 21

ASP.NET and MVC 21

Kubernetes 21

Setting up a development environment 22

1.9 A simple microservices example 22

Creating an empty ASP.NET application 23

Adding ASP.NET MVC to the project 24

Adding an MVC controller with an implementation of the endpoint 25

2 A basic shopping cart microservice 28

2.1 Overview of the Shopping Cart microservice 29

Components of the Shopping Cart microservice 31

2.2 Implementing the Shopping Cart microservice 32

Creating an empty project 32

The Shopping Cart microservice's API for other services 33

Fetching product information 42

Parsing the product response 44

Adding a failure-handling policy 46

Implementing a basic event feed 48

2.3 Running the code 52

3 Deploying a microservice to Kubernetes 54

3.1 Choosing a production environment 55

3.2 Putting the Shopping Cart microservice in a container 57

Adding a Dockerfile to the Shopping Can microservice 57

Building and running the shopping cart container 58

3.3 Running the shopping cart container in Kubernetes 60

Setting up Kubernetes localhost 60

3.4 Creating Kubernetes deployment for the shopping cart 62

3.5 Running the shopping cart container on Azure Kubernetes Service 65

Setting up AKS 66

Running the shopping cart in AKS 69

Part 2 Building Microservices 73

4 Identifying and scoping microservices 75

4.1 The primary driver for scoping microservices: Business capabilities 76

What is a business capability? 76

Identifying business capabilities 77

Example: Point-of-sale system 78

4.2 The secondary driver for scoping microservices: Supporting technical capabilities 83

What is a technical capability? 83

Examples of supporting technical capabilities 83

Identifying technical capabilities 88

4.3 The tertiary driver for scoping microservices: Supporting efficiency of work 89

4.4 What to do when the correct scope isn't clear 90

Starting a bit bigger 91

Carving out new microservices from existing microservices 94

Planning to carve out new microservices later 96

4.5 Well-scoped microservices adhere to the microservice characteristics 96

Primary scoping to business capabilities leads to good microservices 97

Secondary scoping to support technical capabilities leads to goad microservices 97

Tertiary scoping to support efficiency of work 98

5 Microservice collaboration 100

5.1 Types of collaboration: Commands, queries, and events 101

Commands and queries: Synchronous collaboration 103

Events: Asynchronous collaboration 107

Data formats 109

5.2 Implementing collaboration 110

Setting up a project for the loyalty program 112

Implementing commands and queries 112

Implementing commands with HTTP POST or PUT 113

Implementing queries with HTTP GET 116

Implementing an event-based collaboration 117

Deploying to Kubernetes 122

Building a Docker container special offers microseivice 122

Building a Docker container for both parts of the loyalty program 123

Deploying the loyalty program API and the special offers 125

Deploy EventConsumer 126

6 Data ownership and data storage 130

6.1 Each microservice has a data store 130

6.2 Partitioning data between microservices 131

Rule 1: Ownership of data follows business capabilities 132

Rule 2: Replicate for speed and robustness 133

Where does a microservice store its data? 137

6.3 Implementing data storage in a microservice 139

Preparing a development setup 140

Storing data owned by a microservice 141

Storing events raised by a microservice 145

Setting cache headers in HTTP responses 151

Reading and using cache headers 152

7 Designing for robustness 156

7.1 Expect failures 157

Keeping good logs 159

Using trace IDs 160

Rolling forward vs. rolling backward 161

Don't propagate failures 161

7.2 The client side's responsibility for robustness 163

Robustness pattern: Retry 164

Robustness pattern: Circuit breaker 166

7.3 Implementing robustness patterns 168

Implementing a fast-paced retry strategy with Polly 170

Implementing a circuit breaker with Polly 171

Implementing a slow-paced retty strategy 172

Logging all unhandled exceptions 174

Deploying to Kubernetes 176

8 Writing tests for microservices 177

8.1 What and how to test 178

The test pyramid: What to test in a microservices system 178

System-level tests: Testing a complete microservice system end to end 179

Service-level tests: Testing a microservice from outside its process 180

Unit-level tests: Testing endpoints from within the process 183

8.2 Testing libraries: MicrosoftAspNetCore.TestHost and xUnit 184

Meet Microsoft.AspNetCore.TestHost 184

Meet xUnit 185

xUnit and Mioosoft.AspNetCore.TestHost working together 185

8.3 Writing unit tests using Microsoft.AspNetCore.TestHost 188

Setting up a unit-test project 189

Using the TestServer and HttpClient to unit-test endpoints 190

Injecting mocks into endpoints 193

8.4 Writing service-level tests 197

Creating a service-level test project 198

Creating mocked endpoints 198

Executing the test scenario against the microservice under test 201

Part 3 Handling Cross-Cutting Concerns: Building a Reusable Microservice Platform 205

9 Cross-cutting concerns: Monitoring and logging 207

9.1 Monitoring needs in microservices 208

9.2 Logging needs in microservices 211

Tracing requests across microservices 212

Structured logging with Serilog 213

9.3 Implementing the monitoring endpoints 215

Implementing the /health/live monitoring endpoint 216

Implementing the /health/startup monitoring endpoint 217

9.4 Implementing structured logging 219

Adding a trace ID to all log messages 222

Trace ID is included in outgoing HTTP requests 225

Logging unhandled exceptions 225

9.5 Implementing monitoring and logging in Kubernetes 226

Configure monitoring in Kubernetes 226

10 Securing microservice-to-microservice communication 230

10.1 Microservice security concerns 231

Authenticating users at the edge 232

Authorizing users in microservices 234

How much should microservices trust each Other? 235

10.2 Implementing secure microservice-to-microservice communication 236

Accessing the user identity in the loyalty program 236

Limiting which microservices can communicate 238

11 Building a reusable microservice platform 243

11.1 Creating a new microservice should be quick and easy 244

11.2 Handling cross-cutting concerns 244

11.3 Creating a reusable microservice platform 246

11.4 Packaging and sharing cross-cutting code with NuGet 248

Creating a logging package 249

Creating a package with monitoring endpoints 251

11.5 The ASP.NET pipeline 255

What belongs in middleware? 256

11.6 Writing middleware 257

Middleware as lambdas 257

Middleware classes 258

11.7 Testing middleware and pipelines 259

Part 4 Building Applications 263

12 Creating applications over microservices 265

12.1 End user applications for microservice systems: One or many applications? 266

General-purpose applications 266

Specialized applications 267

12.2 Patterns for building applications over microservices 268

Composite applications: Integrating at the frontend 268

API Gateway 271

Backend for frontend (BFF) pattern 273

When to use each pattern 274

Client-side or server-side rendering? 275

12.3 Example: A shopping cart and a product list 276

Creating an API Gateway 279

Creating the product list GUI 281

Creating the shopping cart GUI 286

Letting users add products to the shopping cart 289

Letting users remove products from the shopping cart 290

Appendix Development environment setup 293

Further reading 299

Index 301

From the B&N Reads Blog

Customer Reviews