【发布时间】:2017-03-08 22:29:00
【问题描述】:
我试图弄清楚如何在 ASP.Net Core 1.1 中基于子域设置站点文化。
我的 Startup.cs
中有以下内容services.Configure<RequestLocalizationOptions>(options =>
{
var supportedCultures = new List<CultureInfo>
{
new CultureInfo("en-US"),
new CultureInfo("fil-PH")
};
options.DefaultRequestCulture = new RequestCulture(culture: "en-US", uiCulture: "en-US");
options.SupportedCultures = supportedCultures;
options.SupportedUICultures = supportedCultures;
if (UrlManagement.IsLocalizedUrl())
{
options.RequestCultureProviders.Insert(0, new CustomRequestCultureProvider(async context =>
{
CultureInfo cultureInfo = UrlManagement.GetCultureInfoFromUrl();
ProviderCultureResult providerCultureResult = await new ProviderCultureResult(cultureInfo.Name);
return providerCultureResult;
}));
}
});
它在构建时抱怨这个错误。
“ProviderCultureResult”不包含“GetAwaiter”的定义 并且没有扩展方法“GetAwaiter”接受第一个参数 可以找到类型“ProviderCultureResult”(您是否缺少使用 指令还是程序集引用?)
如果我删除等待,那么它会抱怨我应该等待。
如果我删除异步,那么它会抱怨它应该是异步的。
【问题讨论】:
标签: asp.net-core asp.net-core-mvc