-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Kestrel named pipes /n/1 #34640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Kestrel named pipes /n/1 #34640
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
0e000ed
Kestrel named pipes
Rick-Anderson 040d6f6
Kestrel named pipes
Rick-Anderson 90c0915
Kestrel named pipes
Rick-Anderson ae9deaf
Kestrel named pipes
Rick-Anderson 2ddeeb6
Kestrel named pipes
Rick-Anderson 0475dfc
Kestrel named pipes
Rick-Anderson 57d2844
Kestrel named pipes
Rick-Anderson c728553
Kestrel named pipes
Rick-Anderson 56bcd67
Kestrel named pipes
Rick-Anderson f0455ad
Kestrel named pipes
Rick-Anderson d7e9c1c
Kestrel named pipes
Rick-Anderson 9706051
Kestrel named pipes
Rick-Anderson c820737
Kestrel named pipes
Rick-Anderson e819f1e
Kestrel named pipes
Rick-Anderson ecd6efc
remove pipOptions
Rick-Anderson 866b9f5
Update sample
JamesNK 457676e
Update sample
JamesNK aa9236b
Update aspnetcore/fundamentals/servers/kestrel/endpoints.md
JamesNK f2548e8
Update aspnetcore/fundamentals/servers/kestrel/endpoints.md
JamesNK File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
33 changes: 27 additions & 6 deletions
33
aspnetcore/fundamentals/servers/kestrel/endpoints/samples/KestrelNamedEP/Program.cs
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,42 @@ | ||
| // <snippet_1> | ||
| using System.IO.Pipes; | ||
| using System.Security.AccessControl; | ||
| using System.Security.Principal; | ||
|
|
||
| var builder = WebApplication.CreateBuilder(); | ||
|
|
||
| builder.WebHost.ConfigureKestrel(options => | ||
| { | ||
| options.ListenNamedPipe("pipe1"); | ||
| options.ListenNamedPipe("pipe2"); | ||
| options.ListenNamedPipe("defaultPipe"); | ||
| options.ListenNamedPipe("securedPipe"); | ||
| }); | ||
|
|
||
| builder.WebHost.UseNamedPipes(options => | ||
| { | ||
| options.CreateNamedPipeServerStream = (context) => | ||
| { | ||
| var pipeSecurity = CreatePipeSecurity(context.NamedPipeEndpoint.PipeName); | ||
| var pipeName = context.NamedPipeEndPoint.PipeName; | ||
|
|
||
| switch (pipeName) | ||
| { | ||
| case "defaultPipe": | ||
| return NamedPipeTransportOptions.CreateDefaultNamedPipeServerStream(context); | ||
| case "securedPipe": | ||
| var allowSecurity = new PipeSecurity(); | ||
| allowSecurity.AddAccessRule(new PipeAccessRule("Users", PipeAccessRights.FullControl, AccessControlType.Allow)); | ||
|
|
||
| return NamedPipeServerStreamAcl.Create(context.NamedPipeEndPoint.PipeName, PipeDirection.InOut, | ||
| NamedPipeServerStream.MaxAllowedServerInstances, PipeTransmissionMode.Byte, | ||
| context.PipeOptions, inBufferSize: 0, outBufferSize: 0, pipeSecurity); | ||
| return NamedPipeServerStreamAcl.Create(pipeName, PipeDirection.InOut, | ||
| NamedPipeServerStream.MaxAllowedServerInstances, PipeTransmissionMode.Byte, | ||
| context.PipeOptions, inBufferSize: 0, outBufferSize: 0, allowSecurity); | ||
| default: | ||
| throw new InvalidOperationException($"Unexpected pipe name: {pipeName}"); | ||
| } | ||
| }; | ||
| }); | ||
|
|
||
| var app = builder.Build(); | ||
|
|
||
| app.MapGet("/", () => "Hello World!"); | ||
|
|
||
| app.Run(); | ||
| // </snippet_1> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.