Hi, I want to disable the audit for the API, but it doesn't work.
this is my code:
[RemoteService]
[Area("app")]
[ControllerName("Job")]
[Route("api/app/jobs")]`
[DisableAuditing]
[HttpGet]
[Route("sync-robot-drivers")]
public Task SyncRobotCodesHasDriver()
{
return _jobAppService.SyncRobotCodesHasDriver();
}
Configure<AbpAspNetCoreAuditingOptions>(options =>
{
var ignoredUrls = new[]
{
"/jobs",
};
foreach (var url in ignoredUrls)
{
options.IgnoredUrls.AddIfNotContains(url);
}
});
ABP Framework version: v.7.3.2 UI Type: Angular Database System: MongoDB Tiered (for MVC) or Auth Server Separated (for Angular): yes Exception message and full stack trace: Steps to reproduce the issue:
8 Answer(s)
-
0
Hello ,
Please check this similar issue https://support.abp.io/QA/Questions/3901/DisableAuditing-not-working-on-Controller-and-Controller-Action
Thank you.
-
0
For the route "/api/app/jobs/sync-robot-drivers"
I have setup like this but doesn't work
var ignoredUrls = new[] { "/jobs", }; foreach (var url in ignoredUrls) { options.IgnoredUrls.AddIfNotContains(url); }
-
0
Hi,
Can you please try with this code
Configure<AbpAspNetCoreAuditingOptions>(options => { options.IgnoredUrls.AddIfNotContains("/api/app/jobs/sync-robot-drivers"); });
-
0
Hmm, that's weird, it still isn't working.
-
0
I have added [DisableAuditing] on controller, api and IgnoredUrls on AbpAspNetCoreAuditingOptions
-
0
Hi,
could you please check is there any logs?
Can you please confirm once where are you adding this provided code? please check this documentation https://docs.abp.io/en/abp/latest/Audit-Logging#abpaspnetcoreauditingoptions
-
0
-
0
Hi, I have followed below steps and it works properly at my end.
Add AbpAudit Module as a project.
I have added this code in hostmodule.cs file in
ConfigureServices()
method.Configure<AbpAspNetCoreAuditingOptions>(options => { options.IgnoredUrls.AddIfNotContains("/api/app/books"); });
Add
[DisableAuditing]
in a controller or appservice.
After following above steps when I call api the entry is not added in AuditLogs table. I think this is what you want , right ?
Please let me know , If anything else required.
Thanks,