-
Notifications
You must be signed in to change notification settings - Fork 440
Handlers are resolved from root scope when using Autofac #157
Comments
@robpex what would need to change in ASP.NET WebHooks itself? The only mention of Autofac I can see is in a sample. FYI that sample is now found under https://github.com/aspnet/WebHooks/tree/dev/samples/GenericReceivers.DependencyInjection and Autofac is used in its |
@dougbu it's been a while, but I tried refreshing my memory from #22 (I think that issue has more detail if you haven't checked it out yet). From @HenrikFrystykNielsen comment on that issue,
So, I suspect that somewhere in those WebHooks extensions, where it "first looks in DI", is where it's resolving from the root scope. But I don't remember whether or not I actually stepped through that code myself. I realize that's not the most helpful, so I'll have another look to see if I can reproduce this again... but I might not have the time to do it until the new year. |
@robpex if we're understanding this issue correctly, one option may be to use ASP.NET's We do not plan to make any changes here. But, I'm leaving it open and marking it as up-for-grabs. |
This issue was moved to aspnet/AspNetWebHooks#25 |
I believe this is the same question that was brought up in issue #22, but I didn't want to reopen an old issue. In that issue, @cwoolum posted some code they used to work around the issue by resolving things from the AutofacWebRequest lifetime scope, but I had some trouble getting that working in my application. I put some debugging around Autofac resolving components, and I noticed that my WebHookHandler is resolved from the root scope rather than AutofacWebRequest and, according to http://docs.autofac.org/en/latest/lifetime/ ...
As a result, the rest of my dependencies are also resolved from root which isn't desired. This seems like something that should be handled via WebHooks, perhaps in one of the registration extensions? Hacking around to get it working with Autofac seems like more work than just implementing web hooks the traditional way so it's difficult to justify using the project without this fixed.
The text was updated successfully, but these errors were encountered: