abp - 使用子域不会解析到租户
问题描述
因此,我尝试使用租户名称的子域来解决此类问题。在我的例子中,在本地主机中工作,我编辑了我的主机文件以指向一个名为 subdomains 的新租户到 localhost 应用程序。
我能够转到该页面并使用 test.mydomain.com:[port] 正确加载,但它似乎不支持我在 ConfigureServices 中设置的 domaintenantresolver。这是测试子域多租户的完全错误的方法吗?
下面的代码是我在ConfigureServices中调用的函数。我还在我的主机文件中添加了以下几行:127.0.0.1 www.mydomain.com 127.0.0.1 www.meme.mydomain.com
private void ConfigureTenantResolver(ServiceConfigurationContext context, IConfiguration configuration)
{
Configure<AbpTenantResolveOptions>(options =>
{
options.TenantResolvers.Insert(1, new DomainTenantResolveContributor($"{0}.mydomain.com:44327"));
// OR
// options.AddDomainTenantResolver($"{0}.mydomain.com:44327");
options.TenantResolvers.Add(new QueryStringTenantResolveContributor());
options.TenantResolvers.Add(new RouteTenantResolveContributor());
options.TenantResolvers.Add(new HeaderTenantResolveContributor());
options.TenantResolvers.Add(new CookieTenantResolveContributor());
});
}
解决方案
推荐阅读
- c# - 我在 C# 中有一个 for 循环我只想运行一次
- android - 带有新 sha1 的 Android Firebase 推送通知
- css - @font-face 图标未在 IE 11 中显示,所有其他浏览器都支持。使用 base64 网址
- c - 在结构中重新分配内存后出现奇怪的文本
- regex - 如何选择包括第三个斜杠(RegExp)在内的所有内容?
- jquery - POST 方法不断收到“404 Not found”错误
- php - 我可以使用哪些机制将结果集传输到另一个视图页面?
- javascript - 如何使用jquery动态更改用wordpress制作的网站中div的背景?
- elasticsearch - 如何在 Elasticsearch 中与 filter 和 must_not 一起编写至少 N 个术语的查询?
- python - 拆分数据框中的几列