Finbuckle / Finbuckle.MultiTenant

Finbuckle.MultiTenant is an open-source multitenancy middleware library for .NET. It enables tenant resolution, per-tenant app behavior, and per-tenant data isolation.
https://www.finbuckle.com/multitenant
Apache License 2.0
1.32k stars 267 forks source link

IdentityDataIsolation with Host Strategy #256

Closed hhuseyinpay closed 4 years ago

hhuseyinpay commented 4 years ago

Hi, I'm trying to run the IdentityDataIsolation example with the host strategy. I made the following changes: Screen Shot 2020-05-04 at 15 42 55 Screen Shot 2020-05-04 at 15 43 01 Screen Shot 2020-05-04 at 15 43 17

It throws the following error: Screen Shot 2020-05-04 at 15 44 53

ZedZipDev commented 4 years ago

What NuGet packages you have installed in the project?

AndrewTriesToCode commented 4 years ago

@hhuseyinpay My guess is it is related to the host matching template here:

.WithHostStrategy("*.__tenant__.?)

What is the url for the request throwing the error? Also I don't see it in your screenshot, but do you still have the default connection string value in the json for the configuration store?

"Finbuckle:MultiTenant:Stores:ConfigurationStore": {
    "Defaults": {
      "ConnectionString": "Data Source=Data/SharedIdentity.db"
    },
    "Tenants": [
      {
        "Id": "finbuckle",
        "Identifier": "finbuckle",
        "Name": "Finbuckle"
      },
      {
        "Id": "megacorp",
        "Identifier": "megacorp",
        "Name": "MegaCorp"
      },
      {
        "Id": "initech",
        "Identifier": "initech",
        "Name": "Initech LLC",
        "ConnectionString": "Data Source=Data/InitechIdentity.db"
      }
    ]
  }
ZedZipDev commented 4 years ago

I had the same strange exception. Install NuGets: Microsoft.EntityFrameworkCore Microsoft.EntityFrameworkCore.Sqlite and try again. After it this exception can disappear.

hhuseyinpay commented 4 years ago

@Oleg26Dev I tried but it did not work for me: Screen Shot 2020-05-07 at 12 16 43

@AndrewTriesToCode I'm getting the error at https://localhost:5001/Identity/Account/Register and .../Login Yes, I screenshotted just my edits. So other parts are the same with IdentityDataIsolation example. Screen Shot 2020-05-07 at 12 19 03

hhuseyinpay commented 4 years ago

I find the problem. When using "*.tenant.?" strategy URL should end with .com etc. So I added localhost.com to the hosts file and it worked.