You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you believe you have an issue that affects the security of the platform please do NOT create an issue and instead email your issue details to secure@microsoft.com. Your report may be eligible for our bug bounty but ONLY if it is reported through email.
Describe the bug
If the Properties/launchSettings.json file is missing static assets from Razor class libraries no longer seem to work. They all lead to HTTP 404 status.
To Reproduce
Steps to reproduce the behavior:
Create a blazorserver application using Preview 8: dotnet new blazorserver
Install a third party library that has static assets e.g. Blazored.Toast: dotnet add package Blazored.Toast
Include its CSS file by adding this line to _Host.cshtml: <link href="_content/Blazored.Toast/blazored-toast.css" rel="stylesheet" />
Run the application dotnet run and open the asset by loading https://localhost:5001/_content/Blazored.Toast/blazored-toast.css. You should see the file content.
Stop the application and delete the launchSettings.json file from the Properties directory rm -rf Properties/launchSettings.json
Run the application dotnet run and open the asset by loading https://localhost:5001/_content/Blazored.Toast/blazored-toast.css. It is no longer found.
Expected behavior
The assets should work with or without launchSettings.json.
The text was updated successfully, but these errors were encountered:
Thanks for contacting us, @akorchev.
The StaticWebAssets feature works only in Development by default. You can turn on the feature unconditionally by calling UseStaticWebAssets in the Program.CreateHostBuilder.
FWIW static assets seem to work just fine in production without calling UseStaticWebAssets or having launchSettings.json. It is probably something else that is causing UseStaticWebAssets to be invoked.
ghost
locked as resolved and limited conversation to collaborators
Dec 2, 2019
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
If you believe you have an issue that affects the security of the platform please do NOT create an issue and instead email your issue details to secure@microsoft.com. Your report may be eligible for our bug bounty but ONLY if it is reported through email.
Describe the bug
If the Properties/launchSettings.json file is missing static assets from Razor class libraries no longer seem to work. They all lead to HTTP 404 status.
To Reproduce
Steps to reproduce the behavior:
dotnet new blazorserver
dotnet add package Blazored.Toast
<link href="_content/Blazored.Toast/blazored-toast.css" rel="stylesheet" />
dotnet run
and open the asset by loadinghttps://localhost:5001/_content/Blazored.Toast/blazored-toast.css
. You should see the file content.rm -rf Properties/launchSettings.json
dotnet run
and open the asset by loadinghttps://localhost:5001/_content/Blazored.Toast/blazored-toast.css
. It is no longer found.Expected behavior
The assets should work with or without launchSettings.json.
The text was updated successfully, but these errors were encountered: