Flo*_* F. 0 fileserver mime-types font-awesome owin woff2
由于字体很棒4.3,他们将字体添加为woff2格式.
当我试图通过owin提供这个文件时,我正在问404:
app.UseFileServer(new FileServerOptions() {
RequestPath = PathString.Empty,
FileSystem = new PhysicalFileSystem(@"banana")
});
Run Code Online (Sandbox Code Playgroud)
如何通过owin中的文件服务器提供woff2 mime类型文件?
两种可能性:
var options = new FileServerOptions() {
RequestPath = PathString.Empty,
FileSystem = new PhysicalFileSystem(@"banana")
};
options.StaticFileOptions.ServeUnknownFileTypes = true;
app.UseFileServer(options);
Run Code Online (Sandbox Code Playgroud)
var options = new FileServerOptions() {
RequestPath = PathString.Empty,
FileSystem = new PhysicalFileSystem(@"banana")
};
((FileExtensionContentTypeProvider)options.StaticFileOptions.ContentTypeProvider)
.Mappings.Add(".woff2", "application/font-woff2");
app.UseFileServer(options);
Run Code Online (Sandbox Code Playgroud)
第二种选择似乎并不优雅,但仍然是最好的选择.了解为什么mime类型很重要.
归档时间: |
|
查看次数: |
1005 次 |
最近记录: |