Autofac - The request lifetime scope cannot be created because the HttpContext is not available - due to async code?

前端 未结 3 787
小蘑菇
小蘑菇 2020-12-06 05:08

Short Question: Same as this unanswered problem

Long Question:

I just ported some code over from an MVC 4 + Web Api solution that was using Autofac into my

3条回答
  •  抹茶落季
    2020-12-06 05:48

    We're currently in a situation where we have tests that suffer from the 'missing httpcontext' issue but cannot yet use the excellent recommendations above due to version constraints.

    The way we solved it was to create a 'mock' http context in our test setup: see: Mock HttpContext.Current in Test Init Method

提交回复
热议问题