Skip to content

Commit 3557ff0

Browse files
Save code: Add Kestrel named pipe endpoints (#34639)
* Add Kestrel named pipe endpoints * work * Add Kestrel named pipe endpoints
1 parent 4ac56a7 commit 3557ff0

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

aspnetcore/fundamentals/servers/kestrel/endpoints.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@ description: Learn about configuring endpoints with Kestrel, the cross-platform
55
monikerRange: '>= aspnetcore-5.0'
66
ms.author: tdykstra
77
ms.custom: mvc
8-
ms.date: 06/21/2023
8+
ms.date: 2/4/2025
99
uid: fundamentals/servers/kestrel/endpoints
1010
---
1111

1212
# Configure endpoints for the ASP.NET Core Kestrel web server
1313

1414
[!INCLUDE[](~/includes/not-latest-version.md)]
1515

16-
[!INCLUDE [](~/includes/not-latest-version.md)]
17-
1816
:::moniker range=">= aspnetcore-8.0"
1917

2018
Kestrel endpoints provide the infrastructure for listening to incoming requests and routing them to the appropriate middleware. The combination of an address and a protocol defines an endpoint.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
</Project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System.IO.Pipes;
2+
3+
var builder = WebApplication.CreateBuilder();
4+
5+
builder.WebHost.ConfigureKestrel(options =>
6+
{
7+
options.ListenNamedPipe("pipe1");
8+
options.ListenNamedPipe("pipe2");
9+
});
10+
11+
builder.WebHost.UseNamedPipes(options =>
12+
{
13+
options.CreateNamedPipeServerStream = (context) =>
14+
{
15+
var pipeSecurity = CreatePipeSecurity(context.NamedPipeEndpoint.PipeName);
16+
17+
return NamedPipeServerStreamAcl.Create(context.NamedPipeEndPoint.PipeName, PipeDirection.InOut,
18+
NamedPipeServerStream.MaxAllowedServerInstances, PipeTransmissionMode.Byte,
19+
context.PipeOptions, inBufferSize: 0, outBufferSize: 0, pipeSecurity);
20+
};
21+
});

0 commit comments

Comments
 (0)