ASP.NET CORE MVC For some reason any non png/img files are not being recognized.

I have a GLTF file which is a 3D model, when i open it in my brower it gives 404, the dir has a sub dir called /textures , i can open them and see them . Images show my issues
No description
No description
20 Replies
Angius
Angius11mo ago
By default, only files from wwwroot are served Are those files inside of wwwroot somewhere?
jetblacksalvation
jetblacksalvationOP11mo ago
here is wwwroot
No description
Angius
Angius11mo ago
Seems fine Maybe the file serving middleware just doesn't recognize gltf files as files it should serve
jetblacksalvation
jetblacksalvationOP11mo ago
idk what middleware is. Im learning asp.net, definately not a pro at this
jetblacksalvation
jetblacksalvationOP11mo ago
No description
jetblacksalvation
jetblacksalvationOP11mo ago
does anything here look wrong with this part?
Angius
Angius11mo ago
Yeah, I had to add some stuff to my own project to make it support avif files, gimme a sec No, the csproj looks fine So
jetblacksalvation
jetblacksalvationOP11mo ago
also btw, i compiled some js code from seperate project. So this program is a frankenstien of 2 js code bases
Angius
Angius11mo ago
You will need to set ContentTypeProvider in your .UseStaticFiles() middleware You should have app.UseStaticFiles() somewhere in Program.cs
jetblacksalvation
jetblacksalvationOP11mo ago
ok, got that now i will check
No description
Angius
Angius11mo ago
var extensionsProvider = new FileExtensionContentTypeProvider();
extensionsProvider.Mappings.Add(".gltf", "whatever MIME type gltf files are");

app.UseStaticFiles(new StaticFileOptions {
ContentTypeProvider = extensionsProvider
});
var extensionsProvider = new FileExtensionContentTypeProvider();
extensionsProvider.Mappings.Add(".gltf", "whatever MIME type gltf files are");

app.UseStaticFiles(new StaticFileOptions {
ContentTypeProvider = extensionsProvider
});
Something like this should do the trick You'll need to look up the MIME type for gLTF files
jetblacksalvation
jetblacksalvationOP11mo ago
what the flip
No description
jetblacksalvation
jetblacksalvationOP11mo ago
I was trying to use ai to fix the issue earlier maybe it messed up project
Angius
Angius11mo ago
¯\_(ツ)_/¯
jetblacksalvation
jetblacksalvationOP11mo ago
give me a sec gotta clone my thing again, how should i set up mime? idk what mime is 😢
Angius
Angius11mo ago
Just google "gltf mime type"
jetblacksalvation
jetblacksalvationOP11mo ago
ok
jetblacksalvation
jetblacksalvationOP11mo ago
🙂 that fixed !! thank U
No description
Angius
Angius11mo ago
Nice
jetblacksalvation
jetblacksalvationOP11mo ago
helll yeaaa
No description
Want results from more Discord servers?
Add your server