-
Notifications
You must be signed in to change notification settings - Fork 275
StructureMap cann't resolve dependencies when using child container. #618
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
Comments
Meh, this has come up a couple times now. The policies that do the automatic closing of open generic candidates only apply in the root container. Your use case isn't something I ever anticipated folks doing. You could cheat this by first resolving that service in the root container before using the child container. First though, what's the point in using a child container here? |
It's some kind of webhost orchestration system. |
Wondering why this is closed? Please see structuremap/StructureMap.Microsoft.DependencyInjection#43 for related issue. Is this closed because it's not considered a bug? I'm not really sure what to do to overcome this issue so I have had to switch to autofac where IOptions and child containers works as expected. |
@dazinator StructureMap is no longer actively supported |
@jeremydmiller Oh right - apologies I hadn't realised. I'll take a look at Lamar, and I'll probably stick with autofac for now. Cheers |
Hello, I use StructureMap as replacement of standard container in asp.net core and get strange behavior when use child containers.
I manually instantiate Startup class and pass pre-configured container to it.
My Startup.cs looks like this:
And build host like this:
It's work perfectly, until I start to use child container for my Strartup class.
Following code will fail:
with exception:
StructureMap.StructureMapConfigurationException : No default Instance is registered and cannot be automatically determined for type 'IOptions<KestrelServerOptions>'
It's happens inside WebHost class, when it try to resolve
IServer
instance.Why is it happens?
The text was updated successfully, but these errors were encountered: