2018年10月23日 星期二

Failed to load dae file: the server responded with a status of 404 ()

1. asp.net core failed to load dae file and the server responded with a status of 404 ().
2. Add mime type as follows
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            //app.UseStaticFiles();
            var provider = new FileExtensionContentTypeProvider();
            // Add new mappings
            provider.Mappings[".dae"] = "application/octet-stream";  // "text /xml"; 
            app.UseStaticFiles(new StaticFileOptions
            {
                FileProvider = new PhysicalFileProvider(
            Path.Combine(Directory.GetCurrentDirectory(), "wwwroot")),
                RequestPath = "",
                ContentTypeProvider = provider
            });
        }
3. 一旦可以讀取dae檔案,再移除mime type,仍可以載入dae檔案。

沒有留言:

張貼留言