【发布时间】:2022-12-28 19:48:26
【问题描述】:
我已将 dotnet 应用程序从 Dotnet Core 3.1 升级到 Dotnet 6。升级后出现此错误:
Microsoft.Azure.Storage.StorageException: Only the invariant culture is supported in globalization-invariant mode. See https://aka.ms/GlobalizationInvariantMode for more information. (Parameter 'name')
en-US is an invalid culture identifier.
---> System.Globalization.CultureNotFoundException: Only the invariant culture is supported in globalization-invariant mode. See https://aka.ms/GlobalizationInvariantMode for more information. (Parameter 'name')
为了解决这个问题,我发现我们可以尝试在 csproj 中设置 InvariantGlobalization as false,在 docker 中我们可以设置 ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false。但是当我进行这些更改并重新运行应用程序时,我收到另一个错误提示:
Process terminated. Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again. Alternatively you can set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support. Please see https://aka.ms/dotnet-missing-libicu for more information.
at System.Environment.FailFast(System.String)
修复这些建议与我修复不变文化(第一期)所做的相反。有人可以帮我解决这个问题吗?
我的泊坞窗文件看起来像:
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine3.14 LABEL pipelineName="somedummyapplication" \ pipelineKey="DSENJRNF" \ offeringKey="UQWHCLRA" ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false RUN echo 'http://dl-3.alpinelinux.org/alpine/v3.16/main' >> /etc/apk/repositories RUN apk upgrade && apk add sqlite && apk add krb5 EXPOSE 5000 ENV ASPNETCORE_URLS=http://*:5000 WORKDIR /app COPY . /app USER guest ENTRYPOINT ["dotnet", "abc.somedummyapplication.dll"]我已经检查并尝试这些链接来解决问题,但正如我所说,如果我解决另一个问题出现:Running .NET 6 project in Docker throws Globalization.CultureNotFoundException 和Process terminated. Couldn't find a valid ICU package installed on the system in Asp.Net Core 3 - ubuntu
【问题讨论】:
标签: c# asp.net .net docker .net-core