ASP.NET Core Site Default Culture Issue with IIS – Solution

iis

I have an ASP.NET Core 2.2 site. It has no settings regarding culture (and I don't want to have to specify it on the site, as there are many sites hosted on this computer)

CultureInfo.CurrentCulture is coming back as en-GB but only when the site is deployed behind IIS

When I run it in IIS express, the culture is correctly coming back as en-NZ

In windows, I don't seem to even have GB installed anywhere. The only language I have in the language control panel is English (New Zealand).

In Region, my 'Country or region' is set to New Zealand.

Under Regional format, its set to English (New Zealand).

I have tried deleting and recreating the IIS site and app pool.

In IIS under .NET globalization the culture and ui culture are both set to Invariant Language (Invariant Country) on the site as well as the root level node.

Is there another place I need to set the culture?

The computer is running Windows 10 Pro. It is my dev workstation.

Best Answer

It turned out my problem was caused by the application pool identity having the wrong culture set. I don't know how this happened though.

I was able to fix it by copying the registry settings for a 'good' user and applying them to the application pool user.

https://stackoverflow.com/a/40998971/73135