-
Apr 3rd, 2022, 06:25 AM
#1
Thread Starter
Fanatic Member
Why js,css,lib didn't load from wwwroot?
I made a simple ASP MVC (Net Core 3.1) , I leave it as standard, and deploy it under a subfolder of the Apache (/var/www/html/myapps/app/v1)
I started the kestrel without any errors, I access the page (ie. https://example.com/myapps/app/v1), it shows but some css, js, lib don't load properly (ERR_ABORTED 404 (Not Found), I see they are already in the www-root folder.
what did I miss?
Code:
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
}
-
Apr 5th, 2022, 03:59 AM
#2
Re: Why js,css,lib didn't load from wwwroot?
I cant read you errors, it always better just to add them as text rather than as an image so we can actually read them !
Where have you put your script & link reference lines for your javascript & css files ?
Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you
-
Apr 5th, 2022, 09:08 AM
#3
Thread Starter
Fanatic Member
Re: Why js,css,lib didn't load from wwwroot?
Hi,
Failed to load resource: the server responded with a status of 404 (Not Found)
bootstrap.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
bootstrap.bundle.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
jquery.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
site.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
/favicon.ico:1 Failed to load resource: the server responded with a status of 404 (Not Found)
site.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
bootstrap.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
and yes, I already put them in my _layout.cshtml
Code:
[root@iZk1aa2qin3uxnqh8agvrmZ ~]# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built: Nov 16 2020 16:18:20
[root@iZk1aa2qin3uxnqh8agvrmZ ~]#
my kestrel
Code:
[Service]
WorkingDirectory=/var/www/html/prime/test/v1
ExecStart=/usr/bin/dotnet /var/www/html/prime/test/v1/WebApplication4.dll
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=dotnet-example
User=root
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
# How many seconds to wait for the app to shut down after it receives the initial interrupt signal.
# If the app doesn't shut down in this period, SIGKILL is issued to terminate the app.
# The default timeout for most distributions is 90 seconds.
TimeoutStopSec=90
[Install]
my httpd.conf
Code:
<VirtualHost *:443>
ServerName apps.example.com
ServerAlias apps.example.com
ServerAdmin info@example.com
DocumentRoot /var/www/html
<Directory /var/www/html>
Options -Indexes +FollowSymLinks
AllowOverride All
</Directory>
<Location /myapps/test/v1/>
ProxyPreserveHost On
ProxyPass http://localhost:5003/
ProxyPassReverse http://localhost:5003/
Require all granted
</Location>
I expect I can access it with something like this: https://apps.example.com/myapps/test/v1
please help, this's strange for me..
Last edited by Winanjaya; Apr 5th, 2022 at 09:14 AM.
-
Apr 8th, 2022, 04:45 AM
#4
Re: Why js,css,lib didn't load from wwwroot?
Well your errors suggest that bootstrap is failing to load.
How are you linking to bootstrap? have you downloaded it locally? or are you using a CDN ?
If you have it locally is it being built and included in your deploy package?
Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|