dotnet / dotnet/aspnetcore

app.UseRequestLocalization overwritten on deployed IIS

Open
#58,440 5 comments 0 reactions 0 assignees View on GitHub
area-networking feature-iis
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

In Blazor Server, when setting the `app.UseRequestLocalization("en-GB");` I was under the assumption that your application should always use the "en-GB" culture.

This works correctly locally in my Visual Studio, I can switch the "en-GB" to any other locale and the whole app will switch.
However, I notice that after deploying my application to a local IIS server, the culture is still "en-GB" but for example the decimal seperator is different. (locally the decimal seperator is ".", deployed it's a ",")

It is still using the culture settings of the Windows user that is set as the identity of your application pool.

![Image](https://github.com/user-attachments/assets/b093f021-634c-4ff5-a8be-94857fcce8cb)

### Expected Behavior

- Set `app.UseRequestLocalization("en-GB");`
- Application always uses the same "en-GB" culture.

### Steps To Reproduce

- Create Blazor Web App (Server)
- Add `app.UseRequestLocalization("en-GB");`
- Build application self contained and for win-x64 (--self-contained true --runtime win-x64)
- Deploy application to IIS
Application pool is as follows:
![Image](https://github.com/user-attachments/assets/589c6d14-6dac-466b-9718-310966d76444)
The Identity is a an account, with limited access.

### Exceptions (if any)

_No response_

### .NET Version

8

### Anything else?

ASP.NET CORE 8
Blazor Server
Visual Studio 2022

cc: @guardrex https://github.com/dotnet/AspNetCore.Docs/issues/33847

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.