Unable to up the server .Net with Alpine linux environment with MSSQL

Manish Kumar 0 Reputation points
2023-04-27T05:09:14.33+00:00

Hi,

We have a .Net core Web API application

we have created the server image (Alpine) and trying to host it in docker environment where MSSQL is already installed and configured.

when we try to up the container,

we get this error =>

,"Context":"", "Details":"","Message":"Server initialized with errors. Failed to update server public url and tls certificate thumbprint.System.Globalization.CultureNotFoundException: Only the invariant culture is supported in globalization-invariant mode. See [https://aka.ms/GlobalizationInvariantMode](https://aka.ms/GlobalizationInvariantMode"Follow link") for more information. (Parameter 'name')\nen-us is an invalid culture identifier.\n   at System.Globalization.CultureInfo.GetCultureInfo(String name)\n   at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides)\n   at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides)\n   at Microsoft.Data.SqlClient.SqlConnection.Open()\n   at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.OpenDbConnection(Boolean errorsExpected)\n   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternal(Boolean errorsExpected)\n   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected)\n

We have gone through several technical vlogs and found that others are also facing the same error in similar environment.'

below are my findings :-

  1. Other persons are also facing this error in .Net with Alpine linux environment.
  2. I didn't found any explanation on internet why it's occurs for MSSQL database only.
  3. There are multiple articles like this which is suggesting to set InvariantGlobalization property to false in docker file., but according to our project needs we can't do this bcz we use Invariantculture only. link - https://stackoverflow.com/questions/71045784/running-net-6-project-in-docker-throws-globalization-culturenotfoundexception
  4. According to this article - https://github.com/elastic/apm-agent-dotnet/issues/1985 => this is known bug in .Net 6 that will get fix in later versions. but i'm not sure about this.

Note - In my project, we are not using any culture i.e we're using Invariant culture.

Please provide some help on this..

Is this a known bug in .Net release i.e will .Net6 project won't work with alpine image and MSSQL?

OR, any other way to resolve this issue.

Thanks

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
3,757 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Veeran Puthumkara 0 Reputation points
    2023-10-02T05:57:40.17+00:00

    You have to set the InvariantGlobalization value to false.

    <PropertyGroup>
      <InvariantGlobalization>false</InvariantGlobalization>
    </PropertyGroup>
    
    0 comments No comments