BUG:*.dll等文件无法被访关,这个必诚可配置
This commit is contained in:
parent
747ed3604e
commit
ca3e4b9d20
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
|
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
|
||||||
|
|
||||||
"Urls": "http://*:5005", // 默认端口
|
"Urls": "http://*:5005", // 默认端口
|
||||||
@ -22,6 +22,13 @@
|
|||||||
"ThrowBah": true, // 是否将 Oops.Oh 默认抛出为业务异常
|
"ThrowBah": true, // 是否将 Oops.Oh 默认抛出为业务异常
|
||||||
"LogError": false // 是否输出异常日志
|
"LogError": false // 是否输出异常日志
|
||||||
},
|
},
|
||||||
|
// 静态资源处理方式(允许这些文件补访问)
|
||||||
|
"StaticContentTypeMappings": {
|
||||||
|
".dll": "application/octet-stream",
|
||||||
|
".exe": "application/octet-stream",
|
||||||
|
".pdb": "application/octet-stream",
|
||||||
|
".so": "application/octet-stream"
|
||||||
|
},
|
||||||
"LocalizationSettings": {
|
"LocalizationSettings": {
|
||||||
"SupportedCultures": [ "zh-CN", "en" ], // 语言列表
|
"SupportedCultures": [ "zh-CN", "en" ], // 语言列表
|
||||||
"DefaultCulture": "zh-CN", // 默认语言
|
"DefaultCulture": "zh-CN", // 默认语言
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||||
//
|
//
|
||||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||||
//
|
//
|
||||||
@ -25,6 +25,7 @@ using Newtonsoft.Json;
|
|||||||
using OnceMi.AspNetCore.OSS;
|
using OnceMi.AspNetCore.OSS;
|
||||||
using SixLabors.ImageSharp.Web.DependencyInjection;
|
using SixLabors.ImageSharp.Web.DependencyInjection;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.Encodings.Web;
|
using System.Text.Encodings.Web;
|
||||||
using System.Text.Unicode;
|
using System.Text.Unicode;
|
||||||
@ -274,6 +275,14 @@ public class Startup : AppStartup
|
|||||||
// 特定文件类型(文件后缀)处理
|
// 特定文件类型(文件后缀)处理
|
||||||
var contentTypeProvider = FS.GetFileExtensionContentTypeProvider();
|
var contentTypeProvider = FS.GetFileExtensionContentTypeProvider();
|
||||||
// contentTypeProvider.Mappings[".文件后缀"] = "MIME 类型";
|
// contentTypeProvider.Mappings[".文件后缀"] = "MIME 类型";
|
||||||
|
var cpMappings = App.GetConfig<Dictionary<string, string>>("StaticContentTypeMappings");
|
||||||
|
if (cpMappings != null)
|
||||||
|
{
|
||||||
|
foreach (var key in cpMappings.Keys)
|
||||||
|
{
|
||||||
|
contentTypeProvider.Mappings[key] = cpMappings[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
app.UseStaticFiles(new StaticFileOptions
|
app.UseStaticFiles(new StaticFileOptions
|
||||||
{
|
{
|
||||||
ContentTypeProvider = contentTypeProvider
|
ContentTypeProvider = contentTypeProvider
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user