權限與靜態檔控制改進:

- 修正 admin 目錄預設頁路由,避免 403.14 與不必要的延遲重導
- 停用未使用的 Sites 多站點初始化,減少應用程式啟動成本
- 修正 Response.Redirect 後未 return 的流程,避免 1.8 分鐘超時
- 將資料庫 Connection Timeout 降為 10 秒,加速失敗回應
- 將 runAllManagedModulesForAllRequests 設為 false,讓 JS/CSS 等靜態檔案直接由 IIS 回應
This commit is contained in:
2025-11-12 20:45:34 +08:00
parent ae09a6f487
commit b04c07a5eb
8 changed files with 46 additions and 262 deletions

View File

@@ -25,7 +25,8 @@ public class FilesController : ApiController
[Route("upload/{*url}")]
public async Task<HttpResponseMessage> get_upload(string url)
{
var path = Sites.get_url("upload", url);
// 改用標準路徑(原本使用 Sites 多站點功能,目前已停用)
var path = HttpContext.Current.Server.MapPath($"~/upload/{url}");
if (!System.IO.File.Exists(path))
{
throw new HttpResponseException(HttpStatusCode.NotFound);
@@ -38,7 +39,7 @@ public class FilesController : ApiController
response.Headers.CacheControl = new CacheControlHeaderValue()
{
Public = true,
MaxAge = TimeSpan.FromSeconds(Sites.MaxAge)
MaxAge = TimeSpan.FromSeconds(Sites.MaxAge) // MaxAge 常數仍可使用
};
return response;