Reputation: 73
We are working on a .NET microservices project for a client which will deploy it on Linux docker containers.
After using the client's sdk-alpine as a base image for docker containers we encountered this problem when trying to connect to SQL server:
"Globalization Invariant Mode is not supported"
we are using: .NET 7 and Microsoft.EntityFrameworkCore.SqlServer Version 7.0.13
I have searched and found that alpine does not contain ICU libraries so I added them and it worked, However we can't add new libraries (for some reason unknown to me). So now I'm trying to find another solution if it exists before jumping and telling them there is no other way. Is there a way to enable global invariant or
I tried enabling NLS instead of ICU in docker-compose 'DOTNET_SYSTEM_GLOBALIZATION_USENLS=true' however still not working
Upvotes: 3
Views: 11602
Reputation: 319
I got this error when connecting from a docker container that contains a self-contained .net application to a container with SQL Server.
Adding the following lines to my Dockerfile
helped me
RUN apt-get install -y libicu74
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
I saw the solution here https://github.com/dotnet/SqlClient/issues/220
Upvotes: 0
Reputation: 1
For anyone that finds this in future. I had started using the noble-chisled containers from MCR when I first encountered this.
Setting the values in project settings did nothing, but I didn't have the issue with the runtime:8.0 base image. So I went hunting for what was missing in the chisled container.
Turns out they started releasing "extra" container images which has globalisation enabled.
mcr.microsoft.com/dotnet/runtime:8.0 >> working
mcr.microsoft.com/dotnet/runtime:8.0-noble-chiseled >> not working.
mcr.microsoft.com/dotnet/runtime:8.0-noble-chiseled-extra >> wokring.
Upvotes: 0
Reputation: 104
Changing to false
value you will get the correct result.
<InvariantGlobalization>false</InvariantGlobalization>
Upvotes: 6
Reputation: 93
Removing the following from the Project file resolves the error:
<InvariantGlobalization>true</InvariantGlobalization>
Originally posted as comment by Prashant Rajput.
Upvotes: 8