question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TenantResolver Problem

See original GitHub issue

Hi, @hikalkan , I have upgrade to abp 1.4.1, and got such exception.

Please find the stack trace below:

System.Web.HttpException was unhandled by user code
  ErrorCode=-2147467259
  HResult=-2147467259
  Message=Request is not available in this context
  Source=System.Web
  WebEventCode=0
  StackTrace:
       at System.Web.HttpContext.get_Request()
       at Abp.Web.MultiTenancy.HttpHeaderTenantResolveContributer.ResolveTenantId() in D:\Halil\Github\aspnetboilerplate\src\Abp.Web\Web\MultiTenancy\HttpHeaderTenantResolveContributer.cs:line 26
       at Abp.MultiTenancy.TenantResolver.GetTenantIdFromContributors() in D:\Halil\Github\aspnetboilerplate\src\Abp\MultiTenancy\TenantResolver.cs:line 66
       at Abp.MultiTenancy.TenantResolver.ResolveTenantId() in D:\Halil\Github\aspnetboilerplate\src\Abp\MultiTenancy\TenantResolver.cs:line 54
       at Abp.Runtime.Session.ClaimsAbpSession.get_TenantId() in D:\Halil\Github\aspnetboilerplate\src\Abp\Runtime\Session\ClaimsAbpSession.cs:line 62
       at Abp.Domain.Uow.UnitOfWorkBase.SetFilters(List`1 filterOverrides) in D:\Halil\Github\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkBase.cs:line 374
       at Abp.Domain.Uow.UnitOfWorkBase.Begin(UnitOfWorkOptions options) in D:\Halil\Github\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkBase.cs:line 109
       at Abp.Domain.Uow.UnitOfWorkManager.Begin(UnitOfWorkOptions options) in D:\Halil\Github\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkManager.cs:line 66
       at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\Github\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 51
       at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\Github\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 45
       at Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\Github\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 35
       at Castle.DynamicProxy.AbstractInvocation.Proceed()
       at Castle.Proxies.ExchangeStreamingNotificationWorkerProxy.Start()
       at Abp.Threading.BackgroundWorkers.BackgroundWorkerManager.Add(IBackgroundWorker worker) in D:\Halil\Github\aspnetboilerplate\src\Abp\Threading\BackgroundWorkers\BackgroundWorkerManager.cs:line 51
       at JustMeeting.Integrations.JustMeetingExchangeModule.PostInitialize() in C:\Users\tom\documents\visual studio 2015\Projects\JustMeeting\JustMeeting.Integrations.Exchange\Integrations\JustMeetingExchangeModule.cs:line 28
       at Abp.Modules.AbpModuleManager.<>c.<StartModules>b__15_2(AbpModuleInfo module) in D:\Halil\Github\aspnetboilerplate\src\Abp\Modules\AbpModuleManager.cs:line 48
       at System.Collections.Generic.List`1.ForEach(Action`1 action)
       at Abp.Modules.AbpModuleManager.StartModules() in D:\Halil\Github\aspnetboilerplate\src\Abp\Modules\AbpModuleManager.cs:line 48
       at Abp.AbpBootstrapper.Initialize() in D:\Halil\Github\aspnetboilerplate\src\Abp\AbpBootstrapper.cs:line 132
  InnerException: 

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
hikalkancommented, Feb 4, 2017

Workaround: Clear tenant resolvers list in PreInitialize of your web module:

Configuration.MultiTenancy.Resolvers.Clear();
0reactions
gnomishgizmocommented, Aug 13, 2018

Ok, I take that back.

It’s an earlier errror with the AbpSession variable.

It looks like that value of that variable isn’t getting set in advance of the request being made, which is giving a null tenant to the userManager.

As a temporary workaround, I’ve updated the call in the ImpersonationManager to find the user using GetUserOrNullAsync, and passing the request values in to create a new UserIdentifier.

var user = await _userManager.GetUserOrNullAsync(new UserIdentifier(cacheItem.TargetTenantId.Value, cacheItem.TargetUserId));

Seems to fix this for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No instance of TenantResolver was found for persistence ...
But I get this error message only at startup. To me it looks like it's a startup order issue. Can somebody approve this?...
Read more >
Quarkus: no tenant identifier specified when using ...
Sounds like that inside the lambda the CDI based TenantResolver is not available. Maybe you should create a new issue to do further ......
Read more >
Using OpenID Connect (OIDC) Multi-Tenancy
TenantResolver . This can be done by setting the value for the key OidcUtils.TENANT_ID_ATTRIBUTE on the current RoutingContext . Assuming your application ...
Read more >
Custom Tenant Resolver by Current Logged in User
Learn how to create a custom tenant resolver and use Grails Multi-Tenancy capabilities to switch tenants based on the current logged user or...
Read more >
Multi Tenancy | Documentation Center | ABP.IO
Domain/Subdomain Tenant Resolver. In a real application, most of times you will want to determine current tenant either by subdomain (like mytenant1.mydomain.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found