So after suffering through almost a day worth of reading & trying solution from SO, forums etc., I’ve finally found a solution that works (for now at least). What I had to do was add < add mimeType="model/gltf-binary" enabled="true" />
to my applicationhost.config file in the IISExpress folder. In addition, I had to add the following to my Program.cs file: (ASP.NET specific)
builder.Services.Configure<StaticFileOptions>(options =>
{
options.ContentTypeProvider = new FileExtensionContentTypeProvider
{
Mappings =
{
[".gltf"] = "model/gltf+json",
[".glb"] = "model/gltf-binary",
[".bin"] = "application/octet-stream",
[".obj"] = "model/obj"
}
};
});
Other things I tried that didn’t work for me:
- Adding the following to Startup.cs:
StaticFileOptions options = new StaticFileOptions { ContentTypeProvider = new FileExtensionContentTypeProvider() };
((FileExtensionContentTypeProvider)options.ContentTypeProvider).Mappings.Add(new KeyValuePair<string, string>(".glb", "model/gltf-binary"));
- Creating a web.config with the following content:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<staticContent>
<remove fileExtension=".gltf" />
<mimeMap fileExtension=".gltf" mimeType="model/gltf+json" />
<remove fileExtension=".glb" />
<mimeMap fileExtension=".glb" mimeType="model/gltf-binary" />
<remove fileExtension=".bin" />
<mimeMap fileExtension=".bin" mimeType="application/octet-stream" />
<remove fileExtension=".obj" />
<mimeMap fileExtension=".obj" mimeType="model/obj" />
</staticContent>
</system.webServer>
</configuration>
@RaananW Thanks a lot for pointing me towards MIME, who knows how much longer I would have taken if it weren’t for that suggestion