CSS and JS can't load in WebApp .NET 7
devsuperman
HOBBYOP

2 years ago

Hi, in my localhost is possible to access https://localhost:44373/css/site.css in browser, but when the app is hosted the https://designacoes-production.up.railway.app/css/site.css return a 404 httpstatus.

Then my hosted app stay without css and js.

The link of my app is below:
https://designacoes-production.up.railway.app

Why i can't load js and css in my hosted app?

Thanks.

Solved

1 Replies

devsuperman
HOBBYOP

2 years ago

After a lot of fight, i solved! i had to add the next code in my class Program.cs

var builder = WebApplication.CreateBuilder(new WebApplicationOptions { ContentRootPath = AppContext.BaseDirectory});

Thanks!


Status changed to Solved Railway about 2 years ago


Loading...