[フレーム]
BT

InfoQ Software Architects' Newsletter

A monthly overview of things you need to know as an architect or aspiring architect.

View an example

We protect your privacy.

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Unlock the full InfoQ experience

Unlock the full InfoQ experience by logging in! Stay updated with your favorite authors and topics, engage with content, and download exclusive resources.

Log In
or

Don't have an InfoQ account?

Register
  • Stay updated on topics and peers that matter to youReceive instant alerts on the latest insights and trends.
  • Quickly access free resources for continuous learningMinibooks, videos with transcripts, and training materials.
  • Save articles and read at anytimeBookmark articles to read whenever youre ready.

Topics

Choose your language

InfoQ Homepage News ASP.NET Core Updates in .NET 9 Preview 4: Support for OpenAPI Doc Generation, HybridCache and More

ASP.NET Core Updates in .NET 9 Preview 4: Support for OpenAPI Doc Generation, HybridCache and More

May 29, 2024 2 min read

Write for InfoQ

Feed your curiosity. Help 550k+ global
senior developers
each month stay ahead.
Get in touch

Microsoft released .NET 9 Preview 4, which contains features regarding ASP.NET Core: built-in support for OpenAPI document generation, HybridCache API, and adding static SSR pages to a globally interactive Blazor Web app. An improvement has also been implemented to avoid 503 errors during an app recycle in IIS.

The OpenAPI specification is a standard for describing HTTP APIs, enabling integration with client and server generators, testing tools, and documentation. In .NET 9 Preview 4, ASP.NET Core includes built-in support for generating OpenAPI documents for both controller-based and minimal APIs using the Microsoft.AspNetCore.OpenApi package. To take advantage of this feature, the mentioned package should be installed in the relevant web project.

dotnet add package Microsoft.AspNetCore.OpenApi --prerelease

ASP.NET Core's built-in OpenAPI document generation includes support for customizations such as document and operation transformers and the ability to manage multiple OpenAPI documents for a single application. More information about these capabilities is available in the Microsoft.AspNetCore.OpenApi documentation.

Furthermore, .NET 9 Preview 4 introduces the new HybridCache API, addressing gaps in the existing IDistributedCache and IMemoryCache APIs and adding features such as "stampede" protection and configurable serialization. HybridCache uses a multi-tier cache storage system, combining a limited in-process cache with a larger out-of-process cache. This approach provides data retrieval from the in-process cache while preventing backend overload for less frequently accessed data. HybridCache is designed to be a drop-in replacement for most IDistributedCache scenarios.

HybridCache includes support for older .NET runtimes down to .NET Framework 4.7.2 and .NET Standard 2.0.

Blazor Web apps can enable global interactivity, allowing all pages in the app to use an interactive render mode: Server, WebAssembly, or Auto. Pages can now opt out of this global interactivity using the new [ExcludeFromInteractiveRouting] attribute. This attribute causes navigations to the page to exit from interactive routing, forcing a full-page reload. Consequently, the top-level App.razor will re-run, enabling a switch to a different top-level render mode.

To avoid 503 errors during an app recycle in IIS, a default one-second delay is now implemented between IIS notification and ASP.NET Core Module (ANCM) initiation of server shutdown. This delay minimizes race conditions between queuing requests to the new app and rejecting requests to the old app. For slower or CPU-heavy machines, adjusting the delay duration via the ANCM_shutdownDelay environment variable or the shutdownDelay handler setting is recommended.

Further details on the new features in this preview can be found in the release notes.

About the Author

Robert Krzaczyński

Show moreShow less

Rate this Article

Adoption
Style

Related Content

The InfoQ Newsletter

A round-up of last week’s content on InfoQ sent out every Tuesday. Join a community of over 250,000 senior developers. View an example

We protect your privacy.

BT

AltStyle によって変換されたページ (->オリジナル) /