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
Angius12mo ago
By default, only files from wwwroot are served Are those files inside of wwwroot somewhere?
jetblacksalvation
jetblacksalvationOP12mo ago
here is wwwroot
No description
Angius
Angius12mo ago
Seems fine Maybe the file serving middleware just doesn't recognize gltf files as files it should serve
jetblacksalvation
jetblacksalvationOP12mo ago
idk what middleware is. Im learning asp.net, definately not a pro at this
jetblacksalvation
jetblacksalvationOP12mo ago
No description
jetblacksalvation
jetblacksalvationOP12mo ago
does anything here look wrong with this part?
Angius
Angius12mo 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
jetblacksalvationOP12mo ago
also btw, i compiled some js code from seperate project. So this program is a frankenstien of 2 js code bases
Angius
Angius12mo ago
You will need to set ContentTypeProvider in your .UseStaticFiles() middleware You should have app.UseStaticFiles() somewhere in Program.cs
jetblacksalvation
jetblacksalvationOP12mo ago
ok, got that now i will check
No description
Angius
Angius12mo 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
jetblacksalvationOP12mo ago
what the flip
No description
jetblacksalvation
jetblacksalvationOP12mo ago
I was trying to use ai to fix the issue earlier maybe it messed up project
Angius
Angius12mo ago
¯\_(ツ)_/¯
jetblacksalvation
jetblacksalvationOP12mo ago
give me a sec gotta clone my thing again, how should i set up mime? idk what mime is 😢
Angius
Angius12mo ago
Just google "gltf mime type"
jetblacksalvation
jetblacksalvationOP12mo ago
ok
jetblacksalvation
jetblacksalvationOP12mo ago
🙂 that fixed !! thank U
No description
Angius
Angius12mo ago
Nice
jetblacksalvation
jetblacksalvationOP12mo ago
helll yeaaa
No description
Want results from more Discord servers?
Add your server