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
Angius6mo ago
By default, only files from wwwroot are served Are those files inside of wwwroot somewhere?
jetblacksalvation
here is wwwroot
No description
Angius
Angius6mo ago
Seems fine Maybe the file serving middleware just doesn't recognize gltf files as files it should serve
jetblacksalvation
idk what middleware is. Im learning asp.net, definately not a pro at this
jetblacksalvation
does anything here look wrong with this part?
Angius
Angius6mo 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
also btw, i compiled some js code from seperate project. So this program is a frankenstien of 2 js code bases
Angius
Angius6mo ago
You will need to set ContentTypeProvider in your .UseStaticFiles() middleware You should have app.UseStaticFiles() somewhere in Program.cs
jetblacksalvation
ok, got that now i will check
No description
Angius
Angius6mo 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
what the flip
No description
jetblacksalvation
I was trying to use ai to fix the issue earlier maybe it messed up project
Angius
Angius6mo ago
¯\_(ツ)_/¯
jetblacksalvation
give me a sec gotta clone my thing again, how should i set up mime? idk what mime is 😢
Angius
Angius6mo ago
Just google "gltf mime type"
jetblacksalvation
ok
jetblacksalvation
🙂 that fixed !! thank U
No description
Angius
Angius6mo ago
Nice
jetblacksalvation
helll yeaaa
No description
Want results from more Discord servers?
Add your server
More Posts
Persist data between Quartz ExecutionI need to be able to persist data between instance executions. I have to tie two separate jobs togetHow to Transfer Data from one Form to the other FormHey, is there anyone that can help me? Im pretty new to C# and I need help with something. My problASP.NET MVC How to open Database in SQL Server Management Studio (can't connect server)?Pretty much the title. I have tried to go to the connection string to get the the server name and in✅ Urgent | Cannot update property in EF because another instance with the same key is being trackedHi, so I have following code: Basically I get a batch to update the field ```cs var batch = await cSelenium QuestionDo I need tear down etc for finalized product? Im using nunit framework but cant seem to be able to dotnet tool not recognized after local installI am trying to locally install the tool `dotnet-mgcb-editor` from nuget into my repository. But it's✅ Getting error when installing CSharpier globally``` C:\Users\mango\AppData\Local\Temp\c9a0f2f7-6b74-4505-bfe2-8c9a0efe4d18\restore.csproj : error NUDependency injection in WPFI'm trying to do DI in my WPF app. I've read about it on different sites and followed youtubers but Critical Path Method - Issue with Latest Start TimesI have made my program to calculate the project duration, the earliest start time and the latest staHave all ControllerBase ObjectResults return StatusCodeResult with ProblemDetailsI'd like to unify the way errors are returned from my web api. With the introduction of AddProblemDe