question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Serving static .properties file from wwwroot => 404

See original GitHub issue

Hello 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:closed
  • Created 4 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
soelemancommented, Oct 3, 2019

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.

Blazor_Startup

The extensions is here BlazorExtensions.cs on project ContentTypeCustom.

0reactions
julienGrdcommented, Oct 3, 2019

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 !

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found