diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessagesHub.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessagesHub.cs index b6efd868e..ecfffbfa1 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessagesHub.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessagesHub.cs @@ -41,6 +41,9 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs protected IUserGroupStore UserGroupStore => LazyServiceProvider.LazyGetRequiredService(); + protected AbpExceptionHandlingOptions ExceptionHandlingOptions => LazyServiceProvider.LazyGetRequiredService>().Value; + + public override async Task OnConnectedAsync() { await base.OnConnectedAsync(); @@ -167,8 +170,8 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs { var errorInfo = ErrorInfoConverter.Convert(ex, options => { - options.SendExceptionsDetailsToClients = false; - options.SendStackTraceToClients = false; + options.SendExceptionsDetailsToClients = ExceptionHandlingOptions.SendExceptionsDetailsToClients; + options.SendStackTraceToClients = ExceptionHandlingOptions.SendStackTraceToClients; }); await SendMessageAsync( @@ -230,8 +233,8 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs { var errorInfo = ErrorInfoConverter.Convert(ex, options => { - options.SendExceptionsDetailsToClients = false; - options.SendStackTraceToClients = false; + options.SendExceptionsDetailsToClients = ExceptionHandlingOptions.SendExceptionsDetailsToClients; + options.SendStackTraceToClients = ExceptionHandlingOptions.SendStackTraceToClients; }); if (!chatMessage.GroupId.IsNullOrWhiteSpace()) { diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Messages/SignalRMessageSenderProvider.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Messages/SignalRMessageSenderProvider.cs index 7959a17e9..e6d315f88 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Messages/SignalRMessageSenderProvider.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Messages/SignalRMessageSenderProvider.cs @@ -19,14 +19,17 @@ namespace LINGYUN.Abp.IM.SignalR.Messages private readonly AbpIMSignalROptions _options; private readonly IHubContext _hubContext; + private readonly AbpExceptionHandlingOptions _exceptionHandlingOptions; public SignalRMessageSenderProvider( IHubContext hubContext, IAbpLazyServiceProvider serviceProvider, - IOptions options) + IOptions options, + IOptions exceptionHandlingOptions) : base(serviceProvider) { _options = options.Value; + _exceptionHandlingOptions = exceptionHandlingOptions.Value; _hubContext = hubContext; } @@ -99,8 +102,8 @@ namespace LINGYUN.Abp.IM.SignalR.Messages { var errorInfo = errorInfoConverter.Convert(ex, options => { - options.SendExceptionsDetailsToClients = false; - options.SendStackTraceToClients = false; + options.SendExceptionsDetailsToClients = _exceptionHandlingOptions.SendExceptionsDetailsToClients; + options.SendStackTraceToClients = _exceptionHandlingOptions.SendStackTraceToClients; }); if (!chatMessage.GroupId.IsNullOrWhiteSpace()) { diff --git a/aspnet-core/modules/open-api/LINGYUN.Abp.OpenApi.Authorization/LINGYUN/Abp/OpenApi/Authorization/OpenApiAuthorizationService.cs b/aspnet-core/modules/open-api/LINGYUN.Abp.OpenApi.Authorization/LINGYUN/Abp/OpenApi/Authorization/OpenApiAuthorizationService.cs index 1f4040831..6c905f03d 100644 --- a/aspnet-core/modules/open-api/LINGYUN.Abp.OpenApi.Authorization/LINGYUN/Abp/OpenApi/Authorization/OpenApiAuthorizationService.cs +++ b/aspnet-core/modules/open-api/LINGYUN.Abp.OpenApi.Authorization/LINGYUN/Abp/OpenApi/Authorization/OpenApiAuthorizationService.cs @@ -26,17 +26,20 @@ namespace LINGYUN.Abp.OpenApi.Authorization private readonly AbpOpenApiOptions _openApiOptions; private readonly ICurrentClient _currentClient; private readonly IWebClientInfoProvider _clientInfoProvider; + private readonly AbpExceptionHandlingOptions _exceptionHandlingOptions; public OpenApiAuthorizationService( IAppKeyStore appKeyStore, ICurrentClient currentClient, IWebClientInfoProvider clientInfoProvider, - IOptionsMonitor options) + IOptionsMonitor options, + IOptions exceptionHandlingOptions) { _appKeyStore = appKeyStore; _currentClient = currentClient; _clientInfoProvider = clientInfoProvider; _openApiOptions = options.CurrentValue; + _exceptionHandlingOptions = exceptionHandlingOptions.Value; } public async virtual Task AuthorizeAsync(HttpContext httpContext) @@ -177,8 +180,8 @@ namespace LINGYUN.Abp.OpenApi.Authorization var errorInfoConverter = context.RequestServices.GetRequiredService(); var errorInfo = errorInfoConverter.Convert(exception, options => { - options.SendExceptionsDetailsToClients = false; - options.SendStackTraceToClients = false; + options.SendExceptionsDetailsToClients = _exceptionHandlingOptions.SendExceptionsDetailsToClients; + options.SendStackTraceToClients = _exceptionHandlingOptions.SendStackTraceToClients; }); if (context.Request.CanAccept(MimeTypes.Application.Json) || diff --git a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/PlatformManagementHttpApiHostModule.Configure.cs b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/PlatformManagementHttpApiHostModule.Configure.cs index 971eebe0e..bc2c3e591 100644 --- a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/PlatformManagementHttpApiHostModule.Configure.cs +++ b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/PlatformManagementHttpApiHostModule.Configure.cs @@ -14,6 +14,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.Extensions.Caching.StackExchangeRedis; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; using Microsoft.OpenApi.Models; using StackExchange.Redis; using System; @@ -164,10 +165,11 @@ public partial class PlatformManagementHttpApiHostModule }); Configure(options => - { - // 是否发送错误详情 - options.SendExceptionsDetailsToClients = false; - }); + { + // 是否发送错误详情 + options.SendExceptionsDetailsToClients = true; + options.SendStackTraceToClients = true; + }); } private void ConfigureAuditing(IConfiguration configuration)