-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add support delegating requests in HttpSysServer #24857
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
Conversation
|
Sample usage: namespace Sample
{
public class Startup
{
private DelegationRule _delegationRule;
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostApplicationLifetime lifetime, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
var delegator = app.ServerFeatures.Get<IServerDelegationFeature>();
_delegationRule = delegator.CreateDelegationRule("DefaultAppPool", "http://*:80/");
app.Run(context =>
{
var transferFeature = context.Features.Get<IHttpSysRequestTransferFeature>();
transferFeature.TransferRequest(_delegationRule);
return Task.CompletedTask;
});
lifetime.ApplicationStopped.Register(() => _delegationRule.Dispose());
}
}
} |
|
Thank you for submitting this for API review. This will be reviewed by @dotnet/aspnet-api-review at the next meeting of the ASP.NET Core API Review group. Please ensure you take a look at the API review process documentation and ensure that:
|
|
We shouldn't do this, it isn't common enough to move top level, even as an extension method. |
33696b1 to
8726db0
Compare
|
I ran a perf test with this program app.Run(async context =>
{
await context.Request.Body.DrainAsync(CancellationToken.None);
context.Response.StatusCode = StatusCodes.Status200OK;
});Baseline from master:
My changes with
My changes with
|
|
And good measure I ran my changes with
|
|
TL;DR: No observable change in perf for the identified worst case with this change. |
|
@Pilchie Can I get permission to merge this change? |
This is still tell mode, release/5.0 does not require additional merge permissions. |
Addresses #21163