public HttpContextBase Current() { var httpContext = GetStaticProperty(); if (!IsBackgroundHttpContext(httpContext)) { return(new HttpContextWrapper(httpContext)); } if (_httpContext != null) { return(_httpContext); } if (_wca == null && _lifetimeScope.IsRegistered <IWorkContextAccessor>()) { _wca = _lifetimeScope.Resolve <IWorkContextAccessor>(); } var workContext = _wca != null?_wca.GetLogicalContext() : null; return(workContext != null ? workContext.HttpContext : null); }