Starts in:
1 DAY
1 HR
11 MIN
48 SEC
Starts in:
1 D
1 H
11 M
48 S
Open Closed

Receiving HttpStatusCode 404 when executing endpoints from 2nd service #8303


User avatar
0
suresht created
  • 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


2 Answer(s)
  • User Avatar
    0
    suresht created

    Hello,

    Following up to find out if you will be able to provide assistance on this ticket?

    Thanks in advance,

    Suresh

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I can't see any difference between services 1 and 2.

    could you please use a new project to reproduce the problem? I will check it. my email is shiwei.liang@volosoft.com

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06