0

I am trying to use Google's to display 3D model. However, I can't pass the src tag in html.

My .cshtml for this website is <model-viewer src="~/resources/Astronaut.glb" auto-rotate> </model-viewer>.

I am getting an error Failed to load resource: the server responded with a status of 404 ()

I added the static file path and added a display of the directory (just to confirm there is a file there) in my Program.cs like this:

app.UseStaticFiles();

var fileProvider = new PhysicalFileProvider(Path.Combine(builder.Environment.WebRootPath, "resources"));
var requestPath = "/resources";

// Enable displaying browser links.
app.UseStaticFiles(new StaticFileOptions
{
    FileProvider = fileProvider,
    RequestPath = requestPath
});

app.UseDirectoryBrowser(new DirectoryBrowserOptions
{
    FileProvider = fileProvider,
    RequestPath = requestPath
});

The 3D model is: https://github.com/google/model-viewer/blob/master/packages/shared-assets/models/Astronaut.glb

What is the problem and how can I solve it?

0 Answers0