Activities of "maliming"

hi

Join again : )

https://us05web.zoom.us/j/84339905664?pwd=RbkuzUzEgIzn0sZUT2ia7Ne6IObWLU.1

hi

https://us05web.zoom.us/j/82128719932?pwd=NSkf1WcgITWWyrGKvgMw8xqrZnFaeC.1

hi

url: greentherm.app.localhost
templateUrl: https://{0}.app.localhost:44399

Try the code below:

[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IMultiTenantUrlProvider), typeof(MultiTenantUrlProvider))]
public class WebAssemblyMultiTenantUrlProvider : MultiTenantUrlProvider
{
    private readonly static string[] ProtocolPrefixes = ["http://", "https://"];

    protected NavigationManager NavigationManager { get; }
    protected ILogger<WebAssemblyMultiTenantUrlProvider> Logger { get; }

    public WebAssemblyMultiTenantUrlProvider(
        ICurrentTenant currentTenant,
        ITenantStore tenantStore,
        NavigationManager navigationManager,
        ILogger<WebAssemblyMultiTenantUrlProvider> logger)
        : base(currentTenant, tenantStore)
    {
        NavigationManager = navigationManager;
        Logger = logger;
    }

    public async override Task<string> GetUrlAsync(string templateUrl)
    {
        Logger.LogError("templateUrl: " + templateUrl); // https://{0}.app.localhost:44399

        if (!CurrentTenant.IsAvailable)
        {
            var absoluteUri = NavigationManager.ToAbsoluteUri(NavigationManager.Uri);
            var url = absoluteUri.Authority.RemovePostFix("/");
            Logger.LogError("url: " + url); // greentherm.app.localhost:44399
            
            var myTemplateUrl = templateUrl.RemovePreFix(ProtocolPrefixes).RemovePostFix("/");
            Logger.LogError("myTemplateUrl: " + url); // {0}.app.localhost:44399
            
            var extractResult = FormattedStringValueExtracter.Extract(url, myTemplateUrl, ignoreCase: true);
            if (extractResult.IsMatch)
            {
                var tenant = extractResult.Matches[0].Value; // should be greentherm
                Logger.LogError("tenant: " + tenant);
                
                var apiUrl = templateUrl.Replace("{0}", tenant);
                Logger.LogError("apiUrl: " + apiUrl); // https://greentherm.app.localhost:44399
                return apiUrl;
            }
            
            Logger.LogError("No match tenant found");
        }

        return await GetUrlAsync(templateUrl);
    }
}

Thanks.

hi

Please change "BaseUrl": "https://{{tenantName}}.safetyplus-dev.com" to "BaseUrl": "https://{0}.safetyplus-dev.com"

And try adding WebAssemblyMultiTenantUrlProvider to your blazer.client project and check the error messages in the browser console.

Thanks. I have refunded your ticket.

[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IMultiTenantUrlProvider), typeof(MultiTenantUrlProvider))]
public class WebAssemblyMultiTenantUrlProvider : MultiTenantUrlProvider
{
    private readonly static string[] ProtocolPrefixes = ["http://", "https://"];

    protected NavigationManager NavigationManager { get; }
    protected ILogger<WebAssemblyMultiTenantUrlProvider> Logger { get; }

    public WebAssemblyMultiTenantUrlProvider(
        ICurrentTenant currentTenant,
        ITenantStore tenantStore,
        NavigationManager navigationManager,
        ILogger<WebAssemblyMultiTenantUrlProvider> logger)
        : base(currentTenant, tenantStore)
    {
        NavigationManager = navigationManager;
        Logger = logger;
    }

    public async override Task<string> GetUrlAsync(string templateUrl)
    {
        Logger.LogError("templateUrl: " + templateUrl); // https://{0}.safetyplus-dev.com

        if (!CurrentTenant.IsAvailable)
        {
            var absoluteUri = NavigationManager.ToAbsoluteUri(NavigationManager.Uri);
            var url = absoluteUri.Host;
            Logger.LogError("url: " + url); // greentherm.safetyplus-dev.com

            var extractResult = FormattedStringValueExtracter.Extract(url, templateUrl, ignoreCase: true);
            if (extractResult.IsMatch)
            {
                var tenant = extractResult.Matches[0].Value; // should be greentherm
                Logger.LogError("tenant: " + tenant);
                
                var apiUrl = templateUrl.Replace("{0}", tenant);
                Logger.LogError("apiUrl: " + apiUrl); // https://greentherm.safetyplus-dev.com
                return apiUrl;
            }

            Logger.LogError("No match tenant found");
        }

        return await GetUrlAsync(templateUrl);
    }
}

hi

I found the problem. I will provide the solution soon

hi

Can I check it by zoom?

https://us05web.zoom.us/j/87291194012?pwd=PmbAE6qr5bCKGGAnpRM3FKhfI7i24a.1

You can join and share your screen.

Thanks

hi Buckoge

We may need to use some variables or expressions in the template. I think it is best to have someone who knows a little bit about programming maintain the template.

hi

You can inject the logger and write some error logs in your MyRemoteServiceConfigurationProvider. then check it in the browser console.

Answer

hi mahuwei Please create a new question and share your problem details. Thanks.

hi

[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IRemoteServiceConfigurationProvider), typeof(RemoteServiceConfigurationProvider))]
public class MyRemoteServiceConfigurationProvider

https://abp.io/docs/latest/framework/fundamentals/dependency-injection#combining-all-together

Showing 4361 to 4370 of 11558 entries
Learn More, Pay Less
33% OFF
All Trainings!
Get Your Deal
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on December 25, 2025, 06:16
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.