Base solution for your next web application
Open Closed

No component for supporting the service Abp.Runtime.Session.IAbpSession was found #8114


User avatar
0
amer_op created

hello , i am having preplem with this code -->

public IServiceProvider ConfigureServices(IServiceCollection services)
{
    services.AddDevExpressControls(settings => settings.Resources = ResourcesType.ThirdParty | ResourcesType.DevExtreme);
    var session = IocManager.Instance.Resolve<IAbpSession>();
    DevExpress.XtraReports.Web.Extensions.ReportStorageWebExtension.RegisterExtensionGlobal(new MyReportStorageWebExtension(session));
}

it throws this exception --?>

ComponentNotFoundException: No component for supporting the service Abp.Runtime.Session.IAbpSession was found
Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy)
Castle.MicroKernel.DefaultKernel.Resolve(Type service, IDictionary arguments)
Castle.Windsor.WindsorContainer.Resolve<T>()
Abp.Dependency.IocManager.Resolve<T>()
SmartOptical.Web.Startup.Startup.ConfigureServices(IServiceCollection services) in Startup.cs
+
            DevExpress.XtraReports.Web.Extensions.ReportStorageWebExtension.RegisterExtensionGlobal(new MyReportStorageWebExtension(IocManager.Instance.Resolve<IAbpSession>()));
Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize()
Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

any help ? all i want is to use AbpSession object in side 'MyReportStorageWebExtension' class


6 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    Please try moving the code below into the module's PostInitialize method

     var session = IocManager.Instance.Resolve<IAbpSession>();
        DevExpress.XtraReports.Web.Extensions.ReportStorageWebExtension.RegisterExtensionGlobal(new MyReportStorageWebExtension(session));
    
  • User Avatar
    0
    amer_op created

    exception disappeared , but AbpSession object is empty

  • User Avatar
    0
    amer_op created

    any thoughts ?

  • User Avatar
    0
    maliming created
    Support Team

    Can you access HttpContext in the method of MyReportStorageWebExtension?

    see Determining Current Tenant:https://aspnetboilerplate.com/Pages/Documents/Multi-Tenancy#determining-current-tenant

  • User Avatar
    0
    maliming created
    Support Team

    Can you access HttpContext in the method of MyReportStorageWebExtension?

    see Determining Current Tenant:https://aspnetboilerplate.com/Pages/Documents/Multi-Tenancy#determining-current-tenant

  • User Avatar
    0
    ismcagdas created
    Support Team

    This issue is closed because it has not had recent activity for a long time.