Serving static .properties file from wwwroot => 404
See original GitHub issueHello guys, i try actually to use a worker (https://github.com/mozilla/pdf.js) in my blazor app, worker who need to read some .properties files.
It seem the file are not accessible by default, i always have a 404 error when i try to access it.
How to reproduce :
- create a blazor webAssembly app .net core hosted
- on the wwwroot of the client project, put one test.json and one test.properties file
- launch the app
- open the url https://localhost:xxxxx/test.json => OK
- open the url https://localhost:xxxxx/test.properties=> 404
I try to add a mapping to this extension on the startup as i see on internet
var provider = new FileExtensionContentTypeProvider();
provider.Mappings[".properties"] = "application/octet-stream";
app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = provider });
- on the startup of the server project : no effect
- on the startup of the client project : it seem i can’t put this code here. I need a IApplicationBuilder on entry point, and on the client side i have a ComponentsApplicationBuilder.
Thanks for your help !
Julien
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Serving static .properties file from wwwroot => 404 #14634
properties files. It seem the file are not accessible by default, i always have a 404 error when i try to access it....
Read more >ASP.NET Core 5.0 Web App - published out of the box ...
Static files are stored within the project's web root directory. The default directory is {content root}/wwwroot, but it can be changed with ...
Read more >static files in wwwroot is not served in asp.net core mvc 6
I have files in my wwwroot folder like so But still im getting 404 error since the css files are not being served,...
Read more >Static files in ASP.NET Core
Learn how to serve and secure static files and configure static file hosting middleware behaviors in an ASP.NET Core web app.
Read more >Working with Static Files - ASP.NET Core Documentation
The static file module provides no authorization checks. Any files served by it, including those under wwwroot are publicly available. To serve files...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I am sorry, my first solution is for web project. Your is Blazor-Client (WASM).
After looking for awhile, i got workaround on adding new MIME.
The extensions is here BlazorExtensions.cs on project ContentTypeCustom.
oups i didn’t see that sorry !
ok i found what’s happen, i was thinking only your UseClientSideBlazorFile was needed but we really need the original one too. now it works.
thanks for your help, the problem is close for me !