-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
I have followed the migration guide from Blazor WebAssembly to Blazor Web App. After migrating, IWebAssemblyHostEnvironment
always returned that I'm running the Production environment.
From what I have tested, I can see that < .NET 8 the response to blazor.boot.json
always returned a Blazor-Environment
header. With the changes described in the migration guide, this is no longer the case and the client cannot determine its environment.
I propose:
- to include a hint regarding this in the migration guide.
- to add a middleware that sets this header again.
My team is totally dissatisfied with the options in the Blazor environment docs. Because they have big disadvantages:
- setting in startup environment doesn't work as described in the docs with the changed
App.razor
in the Server project. (It now hase a Routes component on the server and there is no script tag as in the code example.) Additionally, it is just a heuristic based on the URL instead of a correct way of setting the environment. - setting the environment header via
web.config
is not dynamic.
Expected Behavior
IWebAssemblyHostEnvironment
should return the correct environment after following the migration guide.
Steps To Reproduce
Create a Blazor WebAssembly app that uses IWebAssemblyHostEnvironment
on the client and follow the migration guide to a Blazor Web App.
Exceptions (if any)
No response
.NET Version
8
Anything else?
No response