Base solution for your next web application
Open Closed

MultiTenancy Resolving #5158


User avatar
0
greatsamps created

Hi,

I am having some issues with this. What confuses me is that this has worked previously, so not sure if a recent Nuget update has broken it or not.

I have two tenants configured, the default one, and one named xxx.yyy.io

Beta.gsoc.io resolves to 127.0.0.1 in the development hostfile.

The issue is that when browsing to xxx.yyy.io I end up on the host tenant. I have tried clearing cookies etc, and no luck.

Here are the key bits of code:

public override void PreInitialize()
        {
            Configuration.MultiTenancy.IsEnabled = true;
            Configuration.Modules.AbpWebCommon().MultiTenancy.DomainFormat = "{0}";
 
            Configuration.Modules.AspNetZero().LicenseCode = _appConfiguration["AbpZeroLicenseCode"];
            Configuration.Navigation.Providers.Add<DashboardNavigationProvider>();
        }

Appsettings.json

"App": {
    "WebSiteRootAddress": "http://{TENANCY_NAME}:5000/",
    "RedirectAllowedExternalWebSites": "http://localhost:45776/"
  },

Any idea why this is no longer resolving?


7 Answer(s)
  • User Avatar
    0
    greatsamps created

    So, after a few hours of digging, i can confirm that this is a bug that has been introduced in:

    <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/3254">https://github.com/aspnetboilerplate/as ... ssues/3254</a>

    After rolling back to v3.5 everything is working as expected.

    I am aware that out of the box, the package has not been configured to use a tenant name that is actually a full URL, but that is the requirement of our client.

    Can we get this changed and the bug fixed or failing that. Please advise how we can reference our own tenant resolver to handle this ourselves.

    Thanks,

  • User Avatar
    0
    greatsamps created

    I am getting a few exceptions however on the notifications service that is trying to reference 3.6.1 can you please advise what version of ASP.NET Zero is compatible with v 3.5.0 of ABP?

  • User Avatar
    0
    aaron created
    Support Team

    Any idea why this is no longer resolving?

    Related issue: https://github.com/aspnetboilerplate/aspnetboilerplate/issues/3407

    can you please advise what version of ASP.NET Zero is compatible with v 3.5.0 of ABP?

    v5.3.0+. You can check <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/releases">https://github.com/aspnetzero/aspnet-zero-core/releases</a>.

  • User Avatar
    0
    greatsamps created

    Hi,

    Thanks for the reply. Seems they have managed to break it.

    I am having issues on 3.5 however. i am getting the following exception when loading any page as a tenant:

    System.IO.FileLoadException: 'Could not load file or assembly 'Abp, Version=3.6.1.0, Culture=neutral, PublicKeyToken=null'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'

    I have verified that, 3.6.1 is not referenced on any of my projects, and even cleared the nuget cache to be 100% sure.

    here is the full stack trace:

    at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type, ObjectHandleOnStack keepalive) at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName) at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) at System.Type.GetType(String typeName) at Abp.Notifications.TenantNotificationInfoExtensions.ToTenantNotification(TenantNotificationInfo tenantNotificationInfo) in D:\Github\aspnetboilerplate\src\Abp\Notifications\TenantNotificationInfoExtensions.cs:line 18 at Abp.Notifications.UserNotificationInfoWithNotificationInfoExtensions.ToUserNotification(UserNotificationInfoWithNotificationInfo userNotificationInfoWithNotificationInfo) in D:\Github\aspnetboilerplate\src\Abp\Notifications\UserNotificationInfoWithNotificationInfoExtensions.cs:line 13 at System.Linq.Enumerable.SelectListIterator2.ToList() at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at Abp.Notifications.UserNotificationManager.<GetUserNotificationsAsync>d__2.MoveNext() in D:\Github\aspnetboilerplate\src\Abp\Notifications\UserNotificationManager.cs:line 27 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at Inovine.Gsoc.Portal.Notifications.NotificationAppService.

    Pretty frustrating as an entire day has been wasted trying to figure out what someone else has messed up... guess my fault for updating the packages.....

    Any ideas on this?

  • User Avatar
    0
    aaron created
    Support Team

    Can you check for recent entries in the Notifications/TenantNotifications/UserNotifications tables?

  • User Avatar
    0
    greatsamps created

    Hi,

    Thanks for the quick response!

    You were right, there was an entry in there referencing 3.6.1. I have deleted it and all is well.

    Thanks, would never have thought to check there!

  • User Avatar
    0
    alper created
    Support Team

    thanks for your feedback