From ac7da8dede1b74ff267093e285f18623416cf205 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 5 Aug 2022 15:34:49 +0800 Subject: [PATCH] x --- IRaCIS.Core.API/SignalRHub/UploadHub.cs | 2 ++ IRaCIS.Core.API/Startup.cs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.API/SignalRHub/UploadHub.cs b/IRaCIS.Core.API/SignalRHub/UploadHub.cs index 45c8fee50..05937c83b 100644 --- a/IRaCIS.Core.API/SignalRHub/UploadHub.cs +++ b/IRaCIS.Core.API/SignalRHub/UploadHub.cs @@ -1,6 +1,7 @@ 锘縰sing EasyCaching.Core; using IRaCIS.Core.Domain.Share; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.SignalR; using Microsoft.Extensions.Logging; using System.Threading.Tasks; @@ -15,6 +16,7 @@ namespace IRaCIS.Core.API //[Authorize] [AllowAnonymous] + [DisableCors] public class UploadHub : Hub { diff --git a/IRaCIS.Core.API/Startup.cs b/IRaCIS.Core.API/Startup.cs index c10899168..f2445ef9c 100644 --- a/IRaCIS.Core.API/Startup.cs +++ b/IRaCIS.Core.API/Startup.cs @@ -228,11 +228,11 @@ namespace IRaCIS.Core.API //文件伺服 必须带Token 访问 //app.UseIRacisHostStaticFileStore(env); - app.UseCors(t => t.WithOrigins(new string[] { "null" }).AllowAnyMethod().AllowAnyHeader().AllowCredentials()); + //app.UseCors(t => t.WithOrigins(new string[] { "null" }).AllowAnyMethod().AllowAnyHeader().AllowCredentials()); app.UseEndpoints(endpoints => { - endpoints.MapHub("/UploadHub" ).RequireCors(t=>t.WithOrigins(new string[] {"null"}).AllowAnyMethod().AllowAnyHeader().AllowCredentials()); + endpoints.MapHub("/UploadHub" )/*.RequireCors(t=>t.WithOrigins(new string[] {"null"}).AllowAnyMethod().AllowAnyHeader().AllowCredentials())*/; endpoints.MapControllers(); });