I have a Blazor WASM PWA that I want to be standalone (if possible).
Currently, I am trying to manipulate a json file under wwwroot
Location of Json File
Now, while I am able to read its contents via HttpClient.GetFromJsonAsync, all other attempts to access the File fail.
What I've tried:
- Check if the File exists via File.Exists -> returns false
- Post objects via HttpClient.PostAsJsonAsync -> returns 404 for the Json-File
I know that in WebAssembly, Files are cached/loaded into the browser, so I get why I should be unable to locate the File with a Path like "/datasource-json/Ingredient.json", but why does "GetFromJsonAsync" work with that path then?
Is there something crucial I am missing, and how can I work my way around this?
For this particular project, I do not want to use another Api-Project + Entity Framework if possible.
question from:
https://stackoverflow.com/questions/65832989/blazor-wasm-file-does-not-exist-but-is-readable 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…