Skip to content

Expose IServer.Features to DI #40043

@NGloreous

Description

@NGloreous

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

While adding a new feature to YARP, I had a need to add my new type to DI but my type also required access to a server feature. This didn't work as it seems server features are not added to DI.

I was able to work around this by adding the feature myself via the IServer object:

builder.Services.AddSingleton(p => p.GetRequiredService<IServer>().Features.Get<IServerDelegationFeature>());

Describe the solution you'd like

I think it would be nicer if the server features were added to DI directly when created.

Additional context

No response

Metadata

Metadata

Assignees

Labels

area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions