-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
IWebHostEnvironment missing in RegisterFactory container #81
Comments
Did you try to explicitly register the interface?
|
No because it is already registered in the asp.net core built in service provider that is then registered into unity. Do you mean that I need to resolve it from the built in service provider and register it again into Unity for it to work in the factories? |
All that is registered in core is imported into Unity. Host builder does not pass its internal registrations into user DI, some of these are implicitly created with helper functions. You should verify if it is in the ServiceCollection that is passed into Unity. If not, just manually add it to it. |
But then how is it that I can access it from my main unity container(the container which I'm registering my other services in) by doing this: |
Well, in that case I have no clue. I need a test case with reproduced error to help you. |
I created a test project https://github.com/arian2ashk/UnityAspDotNetCoreTest were you can clone and run it and see the issue. |
Hi @ENikS any news on this issue? |
It might be a while, I am preoccupied with other things at the moment. Recovering from COVID does not help with productivity...
|
Hi, When I use
unityContainer.Resolve<IWebHostEnvironment>();
on the main container it resolve it and return a value but if I use the following code and resolveIWebHostEnvironment
from child container it throws exception:The exception:
Why Asp.net core services are not accessible in the factory?
The text was updated successfully, but these errors were encountered: