*.glb 확장사를 사용하기 위해서 설정한다.
Startup.cs
맵핑을 아래와 같이 설정한다.
provider.Mappings[".glb"] = "model/gltf+binary";
provider.Mappings[".gltf"] = "model/gltf+json";
파일이 있는 경로를 지정한다.
string p = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot\\krcmine");
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), "wwwroot\\krcmine")),
RequestPath = "/krcmine",
ContentTypeProvider = provider
});
전체코드
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
// Set up custom content types -associating file extension to MIME type
var provider = new FileExtensionContentTypeProvider();
// Add new mappings
provider.Mappings[".glb"] = "model/gltf+binary";
provider.Mappings[".gltf"] = "model/gltf+json";
app.UseStaticFiles(); // For the wwwroot folder
string p = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot\\krcmine");
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), "wwwroot\\krcmine")),
RequestPath = "/krcmine",
ContentTypeProvider = provider
});
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapRazorPages();
});
}