0%

A guide to discovering the hidden behaviors of ASP.NET Core that can be customized to optimize your .NET 5 applications

Key Features

  • Customize the default behavior of ASP.NET Core to get the most out of the framework
  • Enhance the app configuration, change the default dependency injection, and build your own tag helpers
  • Discover best practices for configuring ASP.NET Core, from user interface design to hosting it on platforms

Book Description

ASP.NET Core is the most powerful Microsoft web framework. Although it's full of rich features, sometimes the default configurations can be a bottleneck and need to be customized to suit the nature and scale of your app. If you're an intermediate-level .NET developer who wants to extend .NET Core to multiple use cases, it's important to customize these features so that the framework works for you effectively.

Customizing ASP.NET Core 5.0 covers core features that can be customized for developing optimized apps. The customization techniques are also updated to work with the latest .NET 5 framework.

You'll learn essential concepts relating to optimizing the framework such as configuration, dependency injection, routing, action filters, and more. As you progress, you'll be able to create custom solutions that meet the needs of your use case with ASP.NET Core. Later chapters will cover expert techniques and best practices for using the framework for your app development needs, from UI design to hosting. Finally, you'll focus on the new endpoint routing in ASP.NET Core to build custom endpoints and add third-party endpoints to your web apps for processing requests faster.

By the end of this application development book, you'll have the skills you need to be able to customize ASP.NET Core to develop robust optimized apps.

What you will learn

  • Explore various application configurations and providers in ASP.NET Core 5
  • Understand dependency injection in .NET and learn how to add third-party DI containers
  • Discover the concept of middleware and write your own middleware for ASP.NET Core apps
  • Create various API output formats in your API-driven projects
  • Get familiar with different hosting models for your ASP.NET Core app
  • Develop custom routing endpoints and add third-party endpoints
  • Configure WebHostBuilder effectively for your web applications

Who this book is for

This .NET 5 book is for .NET developers who need to change the default behaviors of the framework to help improve the performance of their applications. Intermediate-level knowledge of ASP.NET Core and C# is required before getting started with the book.

Table of Contents

  1. Customizing ASP.NET Core 5.0
  2. Why subscribe?
  3. Foreword
  4. Contributors
  5. About the author
  6. About the reviewer
  7. Packt is searching for authors like you
  8. Preface
    1. ASP.NET Core architecture overview
    2. What is covered in this book?
    3. What is not covered and why?
    4. Who this book is for
    5. What this book covers
    6. To get the most out of this book
    7. Download the example code files
    8. Conventions used
    9. Get in touch
    10. Reviews
  9. Chapter 1: Customizing Logging
    1. Technical requirements
    2. Configuring logging
    3. Creating a custom logger
    4. Plugging in an existing third-party logger provider
    5. Summary
  10. Chapter 2: Customizing App Configuration
    1. Technical requirements
    2. Configuring the configuration
    3. Using typed configurations
    4. Configuration using INI files
    5. Configuration providers
    6. Summary
    7. Further reading
  11. Chapter 3: Customizing Dependency Injection
    1. Technical requirements
    2. Using a different dependency injection container
    3. Looking at the ConfigureServices method
    4. Using a different ServiceProvider type
    5. Registering dependencies with ConfigureContainer
    6. Introducing Scrutor
    7. Summary
  12. Chapter 4: Configuring and Customizing HTTPS with Kestrel
    1. Technical requirements
    2. Introducing Kestrel
    3. Setting up Kestrel
    4. For your safety
    5. Summary
  13. Chapter 5: Using IHostedService and BackgroundService
    1. Technical requirements
    2. Introducing IHostedService
    3. Introducing BackgroundService
    4. Implementing the new Worker Service projects
    5. Summary
  14. Chapter 6: Writing Custom Middleware
    1. Technical requirements
    2. Introducing middleware
    3. Writing a custom middleware
    4. Exploring the potential of middleware
    5. Branching the pipeline with /map
    6. Branching the pipeline with MapWhen()
    7. Creating conditions with middleware
    8. Using middleware on ASP.NET Core 3.0 and later
    9. Rewriting a terminating middleware to current standards
    10. Summary
  15. Chapter 7: Content Negotiation Using a Custom OutputFormatter
    1. Technical requirements
    2. Introducing OutputFormatters
    3. Preparing a test project
    4. Testing the Web API
    5. Creating custom OutputFormatters
    6. Summary
  16. Chapter 8: Managing Inputs with Custom ModelBinders
    1. Technical requirements
    2. Introducing ModelBinders
    3. Preparing the test data
    4. Preparing the test project
    5. Creating PersonsCsvBinder
    6. Using ModelBinder
    7. Testing ModelBinder
    8. Summary
    9. Further reading
  17. Chapter 9: Creating a Custom ActionFilter
    1. Technical requirements
    2. Introducing ActionFilters
    3. Using ActionFilters
    4. Summary
    5. Further reading
  18. Chapter 10: Creating Custom TagHelpers
    1. Technical requirements
    2. Introducing TagHelpers
    3. Creating custom TagHelpers
    4. Examining a more complex scenario
    5. Summary
    6. Further reading
  19. Chapter 11: Configuring WebHostBuilder
    1. Technical requirements
    2. Re-examining WebHostBuilderContext
    3. How does it work?
    4. Summary
  20. Chapter 12: Using Different Hosting Models
    1. Technical requirements
    2. Setting up WebHostBuilder
    3. Setting up Kestrel
    4. Setting up HTTP.sys
    5. Hosting on IIS
    6. Using NGINX or Apache on Linux
    7. Configuring NGINX
    8. Configuring Apache
    9. Summary
    10. Further reading
  21. Chapter 13: Working with Endpoint Routing
    1. Technical requirements
    2. Exploring endpoint routing
    3. Creating custom endpoints
    4. Creating a more complex endpoint
    5. Summary
  22. Other Books You May Enjoy
    1. Leave a review – let other readers know what you think
3.135.202.224