mirror of
https://gitee.com/iioter/iotgateway.git
synced 2024-11-29 18:28:09 +08:00
ServeUnknownFileTypes
This commit is contained in:
parent
a4327735c0
commit
88382b7663
@ -84,31 +84,11 @@ namespace IoTGateway
|
||||
public void Configure(IApplicationBuilder app, IOptionsMonitor<Configs> configs, DeviceService deviceService, ModbusSlaveService modbusSlaveService)
|
||||
{
|
||||
IconFontsHelper.GenerateIconFont();
|
||||
|
||||
var pvd = new StaticFileOptions
|
||||
{
|
||||
FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot")),
|
||||
RequestPath = new PathString(""),
|
||||
//设置不限制content-type 该设置可以下载所有类型的文件,但是不建议这么设置,因为不安全
|
||||
//下面设置可以下载apk和nupkg类型的文件
|
||||
ContentTypeProvider = new FileExtensionContentTypeProvider(new Dictionary<string, string>
|
||||
{
|
||||
{ ".html", "text/html" },
|
||||
{ ".glb", "model/gltf-binary" },
|
||||
{ ".json", " application/json" },
|
||||
{ ".js", "application/javascript" },
|
||||
{ ".css", "text/css" },
|
||||
{ ".wasm", "application/wasm" },
|
||||
{ ".png", "image/png" },
|
||||
{ ".jpg", "image/jpg" },
|
||||
{ ".woff", "application/font-woff" },
|
||||
{ ".woff2", "application/font-woff" },
|
||||
{ ".ico", "image/x-icon" },
|
||||
})
|
||||
};
|
||||
|
||||
app.UseExceptionHandler(configs.CurrentValue.ErrorHandler);
|
||||
app.UseStaticFiles(pvd);
|
||||
app.UseStaticFiles(new StaticFileOptions()
|
||||
{
|
||||
ServeUnknownFileTypes = true
|
||||
});
|
||||
app.UseWtmStaticFiles();
|
||||
app.UseRouting();
|
||||
app.UseWtmMultiLanguages();
|
||||
|
Loading…
Reference in New Issue
Block a user