-
Notifications
You must be signed in to change notification settings - Fork 45
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
Inject HttpRequest #32
Comments
What I use is:
But currently, Startup seems to be not invoked with .net core 2.2 ... |
Yeah, that works great for a regular dotnet core web project. It does not work for Azure Functions. The |
Did you include an [assembly: FunctionsStartup(typeof(MyStartupClass))] attribute somewhere in your function? |
i also would like to be able to inject the httpRequest into a service, e.g. token validation etc. |
Hi,
i cannot see your post…
Which version of which library is now supporting this ?
//nick
… Am 18.12.2020 um 00:33 schrieb Ed Downs ***@***.***>:
This is pretty old, but I needed to do this as well. With the newer injection system, in your Startup class, you can use:
public override void Configure(IFunctionsHostBuilder builder) { builder.Services.AddHttpContextAccessor(); }
Then simply inject IHttpContextAccessor where you need it. Seems to work just fine.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#32 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACL3U64YTEWROQRJT63G3BTSVKIM3ANCNFSM4GVAGHTQ>.
|
I have services that depend on
IHttpContextAccessor
so that certain HTTP Headers and claim data can be accessed. Is there any way to configure DI for some form of the current HttpRequest?The text was updated successfully, but these errors were encountered: