[英]AbpUserRequestCultureProvider returned the following unsupported cultures
When I check my logs on my Angular ASP.NET application, I'm repeatedly getting this error message:当我检查我的 Angular ASP.NET 应用程序的日志时,我反复收到此错误消息:
WARN 2018-07-19 05:43:09,596 [42 ] calization.RequestLocalizationMiddleware - AbpUserRequestCultureProvider returned the following unsupported cultures 'null'. WARN 2018-07-19 05:43:09,596 [42 ] calization.RequestLocalizationMiddleware - AbpUserRequestCultureProvider returned the following unsupported UI Cultures 'null'. WARN 2018-07-19 05:43:09,596 [42 ] calization.RequestLocalizationMiddleware - AbpLocalizationHeaderRequestCultureProvider returned the following unsupported cultures 'null'
Has anyone had any experience with this, or what could be causing the issue?有没有人有这方面的经验,或者可能导致问题的原因是什么?
Any help would be appreciated.任何帮助,将不胜感激。
It means ABP couldn't get user's language from header of the request.这意味着 ABP 无法从请求的标头中获取用户的语言。 Normally it checks the header
.AspNetCore.Culture
and returns null if not found.通常它会检查标头
.AspNetCore.Culture
并在未找到时返回 null。 Check your request headers...检查您的请求标头...
A sample header value is below;示例标题值如下;
.AspNetCore.Culture=c=en|uic=en
我的标题失败了: .AspNetCore.Culture
,这个适用于我的项目:标题: Accept-Language
值:“en-US”。
'null'
culture issue was fixed in Prevent null being saved into user's DefaultLanguage (ABP 4.9, Sep 2019). 'null'
文化问题已在防止将 null 保存到用户的 DefaultLanguage (ABP 4.9,2019 年 9 月)中得到修复。
Another issue is that Nginx as a reverse proxy will not pass headers that contain a period.另一个问题是Nginx 作为反向代理不会传递包含句点的标头。
In this case, the ".AspNetCore.Culture"
header.在这种情况下,
".AspNetCore.Culture"
标头。
Related: Cannot get header that contains a period from NGINX for the "Abp.TenantId"
header (ABP 4.4, Mar 2019).相关:无法从 NGINX 获取包含句点的标头,用于
"Abp.TenantId"
标头(ABP "Abp.TenantId"
年 3 月)。
AbpLocalizationHeaderRequestCultureProvider.HeaderName
is configurable. AbpLocalizationHeaderRequestCultureProvider.HeaderName
是可配置的。
AbpLocalizationHeaderRequestCultureProvider
and set its HeaderName
:AbpLocalizationHeaderRequestCultureProvider
并设置其HeaderName
:// app.UseAbpRequestLocalization();
app.UseAbpRequestLocalization(options =>
{
var headerProvider = options.RequestCultureProviders.OfType<AbpLocalizationHeaderRequestCultureProvider>().First();
headerProvider.HeaderName = "AspNetCore-Culture";
});
'.AspNetCore.Culture'
with 'AspNetCore-Culture'
:'.AspNetCore.Culture'
替换为'AspNetCore-Culture'
:// '.AspNetCore.Culture': `c=${cookieLangValue}|uic=${cookieLangValue}`,
'AspNetCore-Culture': `c=${cookieLangValue}|uic=${cookieLangValue}`,
AbpLocalizationHeaderRequestCultureProvider
with the patch to your project as MyLocalizationHeaderRequestCultureProvider
.AbpLocalizationHeaderRequestCultureProvider
的补丁,以项目为MyLocalizationHeaderRequestCultureProvider
。MyLocalizationHeaderRequestCultureProvider
into RequestCultureProviders
after setting its HeaderName
.MyLocalizationHeaderRequestCultureProvider
到RequestCultureProviders
设置它的后HeaderName
。// app.UseAbpRequestLocalization();
app.UseAbpRequestLocalization(options =>
{
var headerProvider = new MyLocalizationHeaderRequestCultureProvider();
headerProvider.HeaderName = "AspNetCore-Culture";
options.RequestCultureProviders.Insert(2, headerProvider);
});
'.AspNetCore.Culture'
with 'AspNetCore-Culture'
.'.AspNetCore.Culture'
替换为'AspNetCore-Culture'
。You can turn off ignore "invalid" headers in Nginx.您可以在 Nginx 中关闭忽略“无效”标头。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.