✅ CSS styles not loading on "Local" environment, only "Development"
I'm creating an application with razor pages. Everything went fine until I decided to switch from "Development" to "Local" for the environment in launchSettings.json. Now the website has no styles and my static files (css, js) are all empty when viewed in the browser.
How do I fix this? Help really appreciated
11 Replies
That setting only really has three valid settings,
Development
(which ASP treats as development), Staging
and anything else, which ASP treats as Production
.
Its likely that your templates have some env.IsDevelopment
or similar in their branchingI see, but then why do for example my database connection strings work, which I put in appsettings.Local.json?
hosting adds by default appsettings.json and appsettings.{Environment}.json
if you want to use local settings for connection string, it's better to put that in user secrets, which is added by default in development
Unknown User•2w ago
Message Not Public
Sign In & Join Server To View
as Sehra said, it still retains the value you gave for stuff like string interpolation, but if you look at the startup logs, I'm fairly sure you'll see...
hosting environment really only has 3 values, Dev, Staging and Prod
Unknown User•2w ago
Message Not Public
Sign In & Join Server To View
idk what
Local
is supposed to be other than Development
Unknown User•2w ago
Message Not Public
Sign In & Join Server To View
yup
Unknown User•2w ago
Message Not Public
Sign In & Join Server To View
Thank you for your help everyone