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.
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