IIS refuses to serve static .gltf files

Turned out I am using a custom FileServerProvider because I need IoC container to inject it into some controllers later on. (Similar fix works on UseStaticFiles() in Configure method, if the .gltf is in wwwroot.)

In ConfigureServices:

var fileProviderOptions = new FileServerOptions
{
    FileProvider = new PhysicalFileProvider(_ContentStorePath),
    RequestPath = new PathString("/ContentStore")
};
fileProviderOptions.StaticFileOptions.ContentTypeProvider = new FileExtensionContentTypeProvider();
((FileExtensionContentTypeProvider)fileProviderOptions
    .StaticFileOptions.ContentTypeProvider).Mappings[".gltf"] = "model/gltf+json";
services.AddSingleton<IFileServerProvider>(new FileServerProvider(
    new List<FileServerOptions> { fileProviderOptions }
));

So, I had to tell it what gltf is in code. StaticFileOptions is read-only, and ContentTypeProvider is an interface, so a few hoops need jumping through.

In retrospect, maybe this question was better suited to StackOverflow after all.