Skip to content
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

Why the container lifetime difference between AlbaHost ctor and task based #144

Closed
goldenc opened this issue Jun 15, 2023 · 1 comment · Fixed by #145
Closed

Why the container lifetime difference between AlbaHost ctor and task based #144

goldenc opened this issue Jun 15, 2023 · 1 comment · Fixed by #145

Comments

@goldenc
Copy link

goldenc commented Jun 15, 2023

when using the ctor IHttpContextAccessor is regitered as a singleton
https://github.com/JasperFx/alba/blob/master/src/Alba/AlbaHost.cs#L65

when using the For task based api its registered as scoped
https://github.com/JasperFx/alba/blob/master/src/Alba/AlbaHost.cs#L290

When trying to switch I'm now getting errors like
Cannot consume scoped service 'Microsoft.AspNetCore.Http.IHttpContextAccessor' from singleton ...

Why don't they have the same lifetime ?

@Hawxy
Copy link
Collaborator

Hawxy commented Jun 15, 2023

Good spot, will fix this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants