I just deployed a new asp.net core 3.0 project, but it seems most of the files are not loading, e.g. the boostrap, css files and lots of images. (AS the website is all over the place)
I looked through the project (root solution) and included them in my project. (Deleted the entire solution online and re-published it again and again ) even restarted VS.
But it did not change the problem
Here is a browser tools. Any advise ?
Failed to load resource: the server responded with a status of 404 (Not Found)
icon_le.png:1 Failed to load resource: the server responded with a status of 404 (Not Found)
Basket.png:1 Failed to load resource: the server responded with a status of 404 (Not Found)
Upload.png:1 Failed to load resource: the server responded with a status of 404 (Not Found)
HB013.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
HB011-1.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
HB034.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
cupid.png:1 Failed to load resource: the server responded with a status of 404 (Not Found)
icon_flag.png:1 Failed to load resource: the server responded with a status of 404 (Not Found)
heart.png:1 Failed to load resource: the server responded with a status of 404 (Not Found)
totb.png:1 Failed to load resource: the server responded with a status of 404 (Not Found)
ze.png:1 Failed to load resource: the server responded with a status of 404 (Not Found)
e.png:1 Failed to load resource: the server responded with a status of 404 (Not Found)
memories.png:1 Failed to load resource: the server responded with a status of 404 (Not Found)
dropdown_menu_samples4_2.png:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
site.css:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
giphy.gif:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
bible.png:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
site.js:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
dropdown_menu_samples4_2_2.png:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
men.png:1 Failed to load resource: the server responded with a status of 404 (Not Found)
women.png:1 Failed to load resource: the server responded with a status of 404 (Not Found)
Icon_Send_Gift.png:1 Failed to load resource: the server responded with a status of 404 (Not Found)
(index):524 Uncaught TypeError: Cannot read property 'addEventListener' of null
at (index):524
/favicon.ico:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
site.css:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
I created a new project and it worked, so I copied my old project into the new and noticed if I used the old layout page for some reason the static files didnt load, but when I used the new layout page which had not got the include/exclude variables, then
it worked.
Member
265 Points
1172 Posts
ASP.NET hosting project does not load css and other image files
Aug 26, 2019 09:53 PM|afrika|LINK
hi guys
I just deployed a new asp.net core 3.0 project, but it seems most of the files are not loading, e.g. the boostrap, css files and lots of images. (AS the website is all over the place)
I looked through the project (root solution) and included them in my project. (Deleted the entire solution online and re-published it again and again ) even restarted VS.
But it did not change the problem
Here is a browser tools. Any advise ?
All-Star
18815 Points
3831 Posts
Re: ASP.NET hosting project does not load css and other image files
Aug 27, 2019 03:07 AM|Nan Yu|LINK
Hi afrika ,
Where do you put your images , in wwwroot folder ? Also confirm that IIS enables serving Static Content :
https://stackoverflow.com/questions/10512053/css-images-js-not-loading-in-iis
Best Regards,
Nan Yu
Member
265 Points
1172 Posts
Re: ASP.NET hosting project does not load css and other image files
Aug 27, 2019 07:48 AM|afrika|LINK
Yes all those are enabled. unless there is another way to enable things which I havent done
and in my startup.cs file I have
All-Star
18815 Points
3831 Posts
Re: ASP.NET hosting project does not load css and other image files
Aug 28, 2019 02:13 AM|Nan Yu|LINK
Hi afrika ,
Could you please show the project structure , and you did't need to set the StaticFileOptions , since it seems you are mapping wwwroot to wwwroot .
Best Regards,
Nan Yu
Member
265 Points
1172 Posts
Re: ASP.NET hosting project does not load css and other image files
Aug 28, 2019 07:34 AM|afrika|LINK
I dont understand what you mean, but see this
All-Star
18815 Points
3831 Posts
Re: ASP.NET hosting project does not load css and other image files
Aug 29, 2019 02:17 AM|Nan Yu|LINK
Hi afrika,
The image is not shown , please provide the project struct and also refer to document :
https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.0
Best Regards,
Nan Yu
Member
265 Points
1172 Posts
Re: ASP.NET hosting project does not load css and other image files
Aug 29, 2019 09:58 PM|afrika|LINK
Is this what you mean ?
see this
Member
265 Points
1172 Posts
Re: ASP.NET hosting project does not load css and other image files
Aug 31, 2019 06:50 AM|afrika|LINK
I finally solved this problem.
I created a new project and it worked, so I copied my old project into the new and noticed if I used the old layout page for some reason the static files didnt load, but when I used the new layout page which had not got the include/exclude variables, then it worked.