Activities of "suresht"

  • ABP Framework version: v8.3.0
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:
  • I am unable to find examples that show how to implement a central way of auditing API calls from Module to other systems. I have reviewed details at the following link and am following them:
  • https://abp.io/support/questions/218/AbpAuditLogs-and-AbpAuditLogActions
  • Is there a SQL table that is used for audit logging in abp.io like in abp (AbpAuditLogs table)? If so, is there an example you can provide?
  • Thanks
  • ABP Framework version: v8.3.0
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
* An exception was thrown while activating CastandCrew.Payroll.Timecard.CapsPay.v1.CapspaytimecardAppService -> CastandCrew.Payroll.Timecard.Queue.v1.AwsSqsHelper.
Autofac.Core.DependencyResolutionException: An exception was thrown while activating CastandCrew.Payroll.Timecard.CapsPay.v1.CapspaytimecardAppService -> CastandCrew.Payroll.Timecard.Queue.v1.AwsSqsHelper.
 ---> Autofac.Core.DependencyResolutionException: None of the constructors found on type 'CastandCrew.Payroll.Timecard.Queue.v1.AwsSqsHelper' can be invoked with the available services and parameters:
Cannot resolve parameter 'Amazon.SQS.IAmazonSQS sqsClient' of constructor 'Void .ctor(Amazon.SQS.IAmazonSQS)'.
  • Steps to reproduce the issue:
  • Following is the code in the AbpModule class:
[DependsOn(
    typeof(TimecardDomainModule),
    typeof(TimecardApplicationContractsModule),
    typeof(AbpDddApplicationModule),
    typeof(AbpAutoMapperModule)
    )]
public class TimecardApplicationModule : AbpModule
{
    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        var configuration = context.Services.GetConfiguration();
        context.Services.AddAutoMapperObjectMapper<TimecardApplicationModule>();
        Configure<AbpAutoMapperOptions>(options =>
        {
            options.AddMaps<TimecardApplicationModule>(validate: true);
            options.AddProfile<TimecardApplicationAutoMapperProfile>(validate: true);
        });
        //Register an instance as singleton
        context.Services.AddSingleton<AmazonSQSClient>(new AmazonSQSClient());
        //Register a factory method that resolves from IServiceProvider
        context.Services.AddScoped<IAmazonSQS>(
            sp => sp.GetRequiredService<AmazonSQSClient>()
        );
    }
}

Following is the code for AwsSqsHelper class which injects IAmazonSQS:

    public class AwsSqsHelper : ApplicationService, IAwsSqsHelper
    {
        #region Class Variables

        private readonly ILogger<CapspaytimecardAppService> _logger;
        private readonly ISettingProvider _settingProvider;
        private readonly IAmazonSQS _sqsClient;

        #endregion

        #region Constructors

        public AwsSqsHelper(
            IAmazonSQS sqsClient)
        {
            _sqsClient = sqsClient;

            _logger = NullLogger<CapspaytimecardAppService>.Instance;
        }

        #endregion

        #region IAwsSqsHelper Implementation

        public async Task<bool> DeleteMessageAsync(string messageReceiptHandle)
        {
            *** Removed for brevity ***
        }

        public async Task<bool> IsQueueReady()
        {
            *** Removed for brevity ***
        }

        public async Task<List<Message>> ReceiveMessageAsync()
        {
            *** Removed for brevity ***
        }

        public async Task<bool> SendMessageAsync(
            string message,
            SqsMessageAttributes messageAttributes)
        {
            *** Removed for brevity ***
        }

        #endregion
    }

Following is the code for CapspaytimecardAppService:

    public class CapspaytimecardAppService : TimecardAppService, ITimecardAppService
    {
        #region Class Variables

        private readonly IAwsSqsHelper _awsSqsHelper;
        private readonly ICapspaytimecardManager _capsPayManager;
        private readonly ILogger<CapspaytimecardAppService> _logger;
        private readonly IObjectMapper _objectMapper;
        private readonly IStringLocalizer<TimecardResource> _stringLocalizer;

        #endregion

        #region Constructors

        public CapspaytimecardAppService(
            IAwsSqsHelper awsSqsHelper,
            IHttpClientFactory httpClientFactory,
            ICapspaytimecardManager capsPayManager,
            IObjectMapper objectMapper,
            IStringLocalizer<TimecardResource> stringLocalizer) : base(httpClientFactory)
        {
            _awsSqsHelper = awsSqsHelper;
            _capsPayManager = capsPayManager;
            _objectMapper = objectMapper;
            _stringLocalizer = stringLocalizer;

            _logger = NullLogger<CapspaytimecardAppService>.Instance;
        }

        internal CapspaytimecardAppService(
            IAwsSqsHelper awsSqsHelper,
            HttpClient httpClient,
            ICapspaytimecardManager capsPayManager,
            ILogger<CapspaytimecardAppService> logger,
            IObjectMapper objectMapper,
            IStringLocalizer<TimecardResource> stringLocalizer) : base(httpClient)
        {
            _awsSqsHelper = awsSqsHelper;
            _capsPayManager = capsPayManager;
            _logger = logger;
            _objectMapper = objectMapper;
            _stringLocalizer = stringLocalizer;
        }

        #endregion
        
            *** Removed for brevity ***
    }

The code was working until I introduced AmazonSQS implementation. Please let me know if you need additional information.

Thanks.

  • ABP Framework version: v8.3.0
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace: Request reached the end of the middleware pipeline without being handled by application code. Request path: GET http://dev.web-gateway.integrationservices.dev.aws.test.com/api/client/v1/test/contractlocations, Response status code: 404
  • Steps to reproduce the issue:

We have a microservice that has reference to 2 services. When executing endpoints from 1st service, they work. However, when executing endpoints from 2nd service, we get a 404 error. Below are code details:

(Host) Module class from Microservice
=====================================
    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        Configure<AbpAspNetCoreMvcOptions>(options =>
        {
            options
                .ConventionalControllers
                .Create(typeof(IntegrationServicesProjectServiceModule).Assembly, opts =>
                {
                    opts.RemoteServiceName = "ProjectService";
                    opts.RootPath = "project";
                });
        });
    }

(Service 1)  Module class from HttpApi project
==============================================
    public override void PreConfigureServices(ServiceConfigurationContext context)
    {
        PreConfigure<IMvcBuilder>(mvcBuilder =>
        {
            mvcBuilder.AddApplicationPartIfNotExists(typeof(ProjectHttpApiModule).Assembly);
        });

        PreConfigure<AbpAspNetCoreMvcOptions>(options =>
        {
            //1.0 Compatibility version
            options.ConventionalControllers.Create(typeof(ProjectApplicationModule).Assembly, opts =>
            {
                opts.TypePredicate = t => t.Namespace == typeof(CapsPay.v1.CapspayprojectAppService).Namespace;
                //opts.ApiVersions.Add(new ApiVersion(1, 0));
                opts.RootPath = "project/v1";
                opts.UrlControllerNameNormalizer = context =>
                {
                    return context.ControllerName.Replace("project", string.Empty, System.StringComparison.InvariantCultureIgnoreCase);
                };
            });
        });
    }

(Service 2) - Module class from HttpApi project
===============================================
    public override void PreConfigureServices(ServiceConfigurationContext context)
    {
        PreConfigure<IMvcBuilder>(mvcBuilder =>
        {
            mvcBuilder.AddApplicationPartIfNotExists(typeof(ClientHttpApiModule).Assembly);
        });

        PreConfigure<AbpAspNetCoreMvcOptions>(options =>
        {
            //1.0 Compatibility version
            options.ConventionalControllers.Create(typeof(ClientApplicationModule).Assembly, opts =>
            {
                opts.TypePredicate = t => t.Namespace == typeof(CapsPay.v1.CapspayclientAppService).Namespace;
                //opts.ApiVersions.Add(new ApiVersion(1, 0));
                opts.RootPath = "client/v1";
                opts.UrlControllerNameNormalizer = context =>
                {
                    return context.ControllerName.Replace("client", string.Empty, System.StringComparison.InvariantCultureIgnoreCase);
                };
            });
        });
    }

If I change the value, "client/v1" to "project/v1" in service 2, the endpoints from 2nd service work. However, the pathing is not correct and it means that if another microservice has reference to this 2nd service, then we have to change the RootPath value in 2nd service to the new microservice name. This does not seem logical.

Can you please let me know what the issue is? I tried finding articles giving an insight into this implementation but did not find any.

Please let me know if you need any additional information.

Thanks in advance,

Suresh

  • ABP Framework version: v8.3.0
  • UI Type: Angular
  • Database System: SQL Server
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace: The type or namespace name 'ConfigureSwaggerOptions' could not be found (are you missing a using directive or an assembly reference?) The type or namespace name 'SwaggerDefaultValues' could not be found (are you missing a using directive or an assembly reference?)
  • Steps to reproduce the issue:
    • We are using Auto API Controller implementation and trying to make use of versioning. We are following the example provided at:
    • https://abp.io/docs/latest/framework/api-development/versioning
    • Following is the code in the module class of HttpApi project
using Asp.Versioning;
using Asp.Versioning.ApplicationModels;
using Localization.Resources.AbpUi;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Swashbuckle.AspNetCore.SwaggerGen;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;



[DependsOn(
    typeof(ProjectApplicationContractsModule),
    typeof(ProjectApplicationModule),
    typeof(AbpAspNetCoreMvcModule))]
public class ProjectHttpApiModule : AbpModule
{
    public override void PreConfigureServices(ServiceConfigurationContext context)
    {
        //PreConfigure<IMvcBuilder>(mvcBuilder =>
        //{
        //    mvcBuilder.AddApplicationPartIfNotExists(typeof(ProjectHttpApiModule).Assembly);
        //});

        PreConfigure<AbpAspNetCoreMvcOptions>(options =>
        {
            //2.0 Version
            options
                .ConventionalControllers
                .Create(typeof(ProjectApplicationModule).Assembly, opts =>
                {
                    opts.TypePredicate = t => t.Namespace == typeof(CapsPay.v2.CapspayprojectAppService).Namespace;
                    opts.ApiVersions.Add(new ApiVersion(2, 0));
                });

            //1.0 Compatibility version
            options
                .ConventionalControllers
                .Create(typeof(ProjectApplicationModule).Assembly, opts =>
                {
                    opts.TypePredicate = t => t.Namespace == typeof(CapsPay.v1.CapspayprojectAppService).Namespace;
                    opts.ApiVersions.Add(new ApiVersion(1, 0));
                });
        });
    }

    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        Configure<AbpLocalizationOptions>(options =>
        {
            options.Resources
                .Get<ProjectResource>()
                .AddBaseTypes(typeof(AbpUiResource));
        });

        var preActions = context.Services.GetPreConfigureActions<AbpAspNetCoreMvcOptions>();

        Configure<AbpAspNetCoreMvcOptions>(options =>
        {
            options.ConventionalControllers
                .Create(typeof(ProjectApplicationModule).Assembly, opts =>
                {
                    opts.RootPath = "project";
                });

            preActions.Configure(options);
        });

        // Show neutral/versionless APIs.
        context.Services.AddTransient<IApiControllerFilter, NoControllerFilter>();

        context.Services.AddAbpApiVersioning(options =>
        {
            options.ReportApiVersions = true;

            options.AssumeDefaultVersionWhenUnspecified = true;

            //options.ConfigureAbp(preActions.Configure());
        }).AddApiExplorer(options => {
            // add the versioned api explorer, which also adds IApiVersionDescriptionProvider service
            // note: the specified format code will format the version as "'v'major[.minor][-status]"
            options.GroupNameFormat = "'v'VVV";

            // note: this option is only necessary when versioning by url segment. the SubstitutionFormat
            // can also be used to control the format of the API version in route templates
            options.SubstituteApiVersionInUrl = true;
        });

        context.Services.AddTransient<IConfigureOptions<SwaggerGenOptions>, ConfigureSwaggerOptions>();

        context.Services.AddAbpSwaggerGen(options =>
        {
            // add a custom operation filter which sets default values
            options.OperationFilter<SwaggerDefaultValues>();

            options.CustomSchemaIds(type => type.FullName);
        });

        Configure<AbpAspNetCoreMvcOptions>(options =>
        {
            options.ChangeControllerModelApiExplorerGroupName = false;
        });
    }
}

What package(s) need to be installed to resolve errors for "ConfigureSwaggerOptions" and "SwaggerDefaultValues"?

Thanks.

Showing 1 to 4 of 4 entries
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on December 15, 2025, 06:08
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.