Ends in:
7 DAYS
16 HRS
33 MIN
7 SEC
Ends in:
7 D
16 H
33 M
7 S
Open Closed

No Data in MultiTenancy Structure is Coming in Multi-Project #4546


User avatar
0
firatm created
  • ABP Framework version: v4.3.3
  • UI type: Angular
  • DB provider: EF Core (mssql)
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"In a project we have monality (AbpView), this project includes identity server saas and Administration service modules. The version of this project is v4.3.3. Later, we added a microservice project v7.0.1 (SupplierEvaluation) to this project as an additional community. In these two projects, we are routing with gateway.However, in our project, we obtain jwt tokens by connecting the data we pulled from the 2nd project to that project (AbpView) in the ID, and this token also has a tenantId information.With this jwt we can get tenant owner data from AbpView (monalite) project, but not 'tenant owner data' from Supplier evaluation (microservice project). The problem may be caused by the cause.Thanks in advance."

13 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    According to my understanding:

    You can use the JWT to get tenant owner data from Monalite but not SupplierEvaluation.

    What's the result if you output the ICurrentTenant.Id in the SupplierEvaluation project?

  • User Avatar
    0
    firatm created

    Hi ,

    The id and name coming from the ICurrentTenant interface are null.Why is the reason we can't get Tenant information from our supplierevaluation?In addition, in order to solve this situation, we injected the Tenant management module for the SupplierEvaluation service, implanted the ITenantDbContext interface in DbContext, added tables to the database and added tenants manually. The situation was temporarily resolved.Can a different action be taken from this situation? Or is it appropriate to solve this situation?

    Picture1 and Picture2 have from SupplierEvaluation!

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Here are two ways:

    1

    Install the saas domain and entityframeworkcore packages. Set the connection string to read tenant data from the Monalite database: https://docs.abp.io/en/abp/latest/Connection-Strings#configuring-the-database-structures

    "ConnectionStrings": {
      "Saas": "Server=localhost;Database=MyMainDb;Trusted_Connection=True;"
    }
    

    2

    Load the tenant data from the remote service(SupplierEvaluation > gateway > Monalite) You need to install the Volo.Abp.AspNetCore.Mvc.Client package, it provides the MvcRemoteTenantStore class

    • You should configure the Remote service in the SupplierEvaluation project.
    {
      "RemoteServices": {
        "Default": {
          "BaseUrl": "http://localhost:53929/" (gateway)
        } 
      } 
    }
    
    • You should configure the gateway to forward the request
    {
      "ServiceKey": "Multi-tenancy Service",
      "DownstreamPathTemplate": "/api/abp/multi-tenancy/{everything}",
      "DownstreamScheme": "https",
      "DownstreamHostAndPorts": [
        {
          "Host": "localhost",
          "Port": 44367 (Monalite)
        }
      ],
      "UpstreamPathTemplate": "/api/abp/multi-tenancy/{everything}",
      "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ]
    },
    
  • User Avatar
    0
    firatm created

    Hi We have also tried 2 ways that you have sent.But ICurrentTenant.Id 's null keeps coming.The SupplierEvaluation project does not make a request.The error continues.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I'd like check it remotely, can we have a meeting via zoom? shiwei.liang@volosoft.com

  • User Avatar
    0
    firatm created

    Hi ,

    Ok. When should we schedule a meeting?I sent you an e-mail for meeting about.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I don't see the correct configuration.

    You can try:

    • Remove Volo.Abp.TenantManagement.EntityFrameworkCore from SupplierEvaluation.HttpApi.Host project.
    • Install Volo.Abp.AspNetCore.Mvc.Client package to the SupplierEvaluation.HttpApi.Host project
    • Add typeof(AbpAspNetCoreMvcClientModule) to the SupplierEvaluationHttpApiHostModule
    • Configure remote service in the appsettings.json of SupplierEvaluation.HttpApi.Host project.
    {
      "RemoteServices": {
        "Default": {
          "BaseUrl": "https://....." (gateway URL)
        } 
      } 
    }
    
  • User Avatar
    0
    firatm created

    Hi, we tried what you said earlier, but we sent you the status where we removed the code part. i am re-adding it to the project and sharing the images of the error we received below.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I made an example and share it to you, you can check it.

  • User Avatar
    0
    firatm created

    Hi we are tring your shared project but we have some problem in here. (http 403).

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    The permissions will be cached about 10s, you can change the cache time if you want.

  • User Avatar
    0
    firatm created

    Hi This is the error we got in the sample project you sent.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Do not use the routing middleware in the gateway.

    If you use routing middleware, it will handle the request itself instead of forwarding to the service

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06