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(); });