$/
artifacts/
build/
docs/
lib/
packages/
samples/
src/
tests/
This document now exists on the official ASP.NET core docs page.
- Application
- Request Handling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddHttpClient("myclient"); | |
// Global header propagation for any HttpClient that comes from HttpClientFactory | |
services.AddHeaderPropagation(options => | |
{ | |
options.HeaderNames.Add("Correlation-Id"); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Extensions.DependencyInjection; | |
var builder = DistributedApplication.CreateBuilder(args); | |
builder.AddContainer("redis", "redis").WithExplicitStart(); | |
builder.Build().Run(); | |
public static class ExplicitStartupExtensions | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Http.Features; | |
using Microsoft.AspNetCore.WebUtilities; | |
using ProtoBuf; | |
var builder = WebApplication.CreateBuilder(args); | |
var app = builder.Build(); | |
app.MapGet("/", () => "POST a protobuf message to the /"); | |
app.MapPost("/", (Proto<Person> p) => Results.Extensions.Protobuf(p.Item)) | |
.Accepts<Person>("application/protobuf"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Diagnostics; | |
using System.Linq.Expressions; | |
using System.Reflection; | |
using System.Collections.Generic; | |
namespace ConsoleApplication3 | |
{ | |
class Program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Analogy | |
{ | |
/// <summary> | |
/// This example shows that a library that needs access to target .NET Standard 1.3 | |
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET | |
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library. | |
/// </summary>INetCoreApp10 | |
class Example1 | |
{ | |
public void Net45Application(INetFramework45 platform) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Diagnostics; | |
using System.Net.Sockets; | |
using System.Security.Authentication; | |
using Yarp.Telemetry.Consumption; | |
var builder = WebApplication.CreateBuilder(args); | |
builder.Services.AddTelemetryConsumer<TelemetryConsumer>(); | |
var app = builder.Build(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Extensions.Configuration.Memory; | |
var builder = WebApplication.CreateBuilder(args); | |
builder.Configuration.AddConfigurationDefaults(new() | |
{ | |
{ "request:timeout", "60" } | |
}); | |
var app = builder.Build(); |
NewerOlder