I'm using hangfire and for DI using autofac. i want to send email with postal.mvc5 tools and i got this error:

System.InvalidOperationException

The request lifetime scope cannot be created because the HttpContext is not available.

System.InvalidOperationException: The request lifetime scope cannot be created because the HttpContext is not available.
   at Autofac.Integration.Mvc.RequestLifetimeScopeProvider.GetLifetimeScope(Action`1 configurationAction)    
   at Autofac.Integration.Mvc.AutofacDependencyResolver.get_RequestLifetimeScope()
   at Autofac.Integration.Mvc.AutofacDependencyResolver.GetService(Type serviceType)
   at System.Web.Mvc.BuildManagerViewEngine.DefaultViewPageActivator.Create(ControllerContext controllerContext, Type type)
   at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
   at Postal.EmailViewRenderer.RenderView(IView view, ViewDataDictionary viewData, ControllerContext controllerContext, ImageEmbedder imageEmbedder)
   at Postal.EmailViewRenderer.Render(Email email, String viewName)
   at Postal.EmailService.Send(Email email)
   at Postal.Email.Send()
   at Store.Web.Controllers.HomeController.Test() in C:\Users\a\Documents\Visual Studio 2015\Projects\In\S.Web\Controllers\HomeController.cs:line 33

i search 2 days and nothing found about this problem. please help me! Thanks

Related posts

Recent Viewed