Its working now. Thank You
I have sent email.
Sure, I will share with you on Monday.
Yes I checked and the exception code is being executed ..
I have Microservice architecture. I have added Custom exception filter in NxP.Shared.Hosting.Microservices.
namespace NxP.Shared.Hosting.Microservices
{
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(AbpExceptionFilter), typeof(IAsyncExceptionFilter))]
public class GlobalExceptionFilter : AbpExceptionFilter, ITransientDependency
{
private readonly IDistributedEventBus _distributedEventBus;
private readonly ILogger< GlobalExceptionFilter > _logger;
public GlobalExceptionFilter(IDistributedEventBus distributedEventBus, ILogger< GlobalExceptionFilter > logger)
{
_distributedEventBus = distributedEventBus;
_logger = logger;
}
public override async Task OnExceptionAsync(ExceptionContext context)
{
var exception = context.Exception;
var actionDescriptor = context.ActionDescriptor;
var exceptionLogEto = new ExceptionLogEto
{
Message = exception.Message,
Type = exception.GetType().Name,
StackTrace = exception.InnerException?.Message ?? exception.StackTrace,
Source = exception.Source,
ControllerName = actionDescriptor.RouteValues["controller"],
ActionName = actionDescriptor.RouteValues["action"],
};
await _distributedEventBus.PublishAsync(exceptionLogEto);
_logger.LogInformation("Exception handled by GlobalExceptionFilter.");
//await base.OnExceptionAsync(context);
// throw exception;
//context.ExceptionHandled = true;
}
}
}
I have added filters in services in NxPSharedHostingMicroservicesModule
context.Services.AddTransient< GlobalExceptionFilter >();
context.Services.AddControllers(options =>
{
options.Filters.AddService< GlobalExceptionFilter >();
}).AddControllersAsServices();
I have handler in LoggingService to receive exception data and storing in database, but the event is not receiving in LoggingService. There is no exception and event data is not publishing. I have also checked the sample console application.
Handler in logging microservice.
public class ExceptionLogHandler : IDistributedEventHandler< ExceptionLogEto >, ITransientDependency
{
private readonly ILogger< ExceptionLogHandler > _logger;
private readonly IExceptionLogRepository _exceptionLogRepository;
public ExceptionLogHandler(ILogger< ExceptionLogHandler > logger
, IExceptionLogRepository exceptionLogRepository
)
{
_logger = logger;
_exceptionLogRepository = exceptionLogRepository;
_logger.LogInformation("ExceptionLogHandler initialized.");
}
[UnitOfWork]
public async Task HandleEventAsync(ExceptionLogEto eventData)
{
_logger.LogInformation("Handling exception log...");
ExceptionLog exceptionLog = new ExceptionLog(
Guid.NewGuid(),
eventData.Message,
eventData.Type,
eventData.StackTrace,
eventData.Source,
eventData.ControllerName,
eventData.ActionName,
DateTime.Now
);
_logger.LogInformation(Newtonsoft.Json.JsonConvert.SerializeObject(exceptionLog));
await _exceptionLogRepository.InsertAsync(exceptionLog);
}
}
Yes, Angular application is updated to 8.1.3 and if it stable version then why I am getting the above error. I am fine with 8.1.3.
I have just upgraded project to latest version 8.1.0 with "abp update" command. The angular package file as below version.
"@abp/ng.account": "~8.1.3",
"@abp/ng.components": "~8.1.3",
"@abp/ng.core": "~8.1.3",
"@abp/ng.oauth": "~8.1.3",
"@abp/ng.setting-management": "~8.1.3",
"@abp/ng.theme.shared": "~8.1.3",
"@angular/animations": "^17.0.0",
"@angular/common": "^17.0.0",
"@angular/compiler": "^17.0.0",
"@angular/core": "^17.0.0",
"@angular/forms": "^17.0.0",
"@angular/localize": "^17.0.0",
"@angular/platform-browser": "^17.0.0",
"@angular/platform-browser-dynamic": "^17.0.0",
"@angular/router": "^17.0.0",
"@volo/abp.commercial.ng.ui": "~8.1.2",
"@volo/abp.ng.account": "~8.1.2",
"@volo/abp.ng.audit-logging": "~8.1.2",
"@volo/abp.ng.chat": "~8.1.2",
"@volo/abp.ng.gdpr": "~8.1.2",
"@volo/abp.ng.identity": "~8.1.2",
"@volo/abp.ng.language-management": "~8.1.2",
"@volo/abp.ng.account.core": "~8.1.2",
"@volo/abp.ng.openiddictpro": "~8.1.2",
"@volo/abp.ng.saas": "~8.1.2",
"@volo/abp.ng.text-template-management": "~8.1.2",
"@volosoft/abp.ng.theme.lepton-x": "^3.0.1",
After upgrading, I deleted the **node_modules **and lock file, clear the npm cache and install all the packages again. I am getting below error on ng serve.
I have some pages which are not defined in routes. Lets say I have below routes which is defined in routes.
routes.add([
{
path: '/wms',
name: 'Wms',
iconClass: 'fas fa-cubes',
order: 5,
layout: eLayoutType.application,
},
{
path: '/wms/warehouses',
name: 'Warehouse',
parentName: WmsRouteNames.Wms,
requiredPolicy: 'WmsService.Warehouses',
},
I have a route with path '/wms/warehouses' of warehouse listing page but I have separate page to create or update the warehouse data with path '/wms/warehouses/create'. When I navigate to create page, the selection of 'Warehouse' nav item is removed and breadcrumbs is also reset to 'Home' only. I want to set active nav item and breadcrumbs also for all the pages which routes having the path which are not defined in route provider.
I am using the Microservice template. I want to use external provider microsoft login.
I have checked the setting page and there is no account button to setup the external providers.
Auth Server login page with Microsoft Login Button
Angular Login Page, No Microsoft Login Button
That is the question, how can I get the Role id and organization id of user?