我已将Dotnet应用程序从Dotnet Core 3.1升级到Dotnet 6。升级后,我遇到了以下错误:
为了解决这个问题,我发现我们可以尝试在 csproj 中将
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
设置为 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)
为了解决这个问题,建议的方法与我修复不变文化(第一个问题)的方法完全相反。请问有人能帮我解决这个问题吗?
我的 Docker 文件如下:
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"]
我已经检查并尝试了这些链接来解决问题,但正如我所说,如果我解决了一个问题,另一个问题就会出现:在 Docker 中运行 .NET 6 项目时抛出 Globalization.CultureNotFoundException 异常和在 Asp.Net Core 3 - ubuntu 上终止进程。系统中未安装有效的 ICU 包