Starts in:
0 DAY
4 HRS
20 MIN
2 SEC
Starts in:
0 D
4 H
20 M
2 S
Open Closed

Proxies are not getting generated #4921


User avatar
0
viswajwalith created
  • ABP Framework version: v7.1.1
  • UI type: MVC
  • DB provider: EF Core / MongoDB
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"Add new new micro service with MongoDB"

we have created a new micro service to the existing micro service solution, for newly added micro service we are able to see the methods added to Server(Swagger) and Web Gateway but not able to see the proxies generated to consume the same from Web (UI) layer. Can you please give some hint where we might missed out?


23 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You need to manually generate the proxy using ClI: https://docs.abp.io/en/abp/latest/CLI#generate-proxy

  • User Avatar
    0
    viswajwalith created

    Hi,

    You need to manually generate the proxy using ClI: https://docs.abp.io/en/abp/latest/CLI#generate-proxy

    Hi, We already tried this but getting the below errors

    Also the suprise is without doing anything the Proxies got generated for some other services, means Proxies generated for XYZ service but same is not getting generated for PQR service.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Module name: app is invalid

    You need to specify the service(module) name. you can find it in the /api/abp/api-definitionapi-definition endpoint.

    No project file found in the directory. The working directory must have a Web project file

    You need to run the command in the web project directory of the service

  • User Avatar
    0
    viswajwalith created

    Hi,

    Module name: app is invalid

    You need to specify the service(module) name. you can find it in the /api/abp/api-definitionapi-definition endpoint.

    No project file found in the directory. The working directory must have a Web project file

    You need to run the command in the web project directory of the service

    Hi It Seems some issue with main definition itself, not able to see newly added micro service under modules

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can try to access the /api/abp/api-definitionapi-definition endpoint of the service instead of the gateway

  • User Avatar
    0
    viswajwalith created

    /api/abp/api-definitionapi-definition

    If I get the definition for individual micro service the Module is showing up

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I think it should work if you use it to generate client proxy files.

  • User Avatar
    0
    viswajwalith created

    Hi,

    I think it should work if you use it to generate client proxy files.

    I am also not sure tried many ways, what do u suggest now?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    As I understand you want to generate js client proxy files for services.

    • Run the HttpApi.Host project of the service
    • Open a terminal in the root directory of the service web project
    • Run the abp generate-proxy -t js -m userTaskService -url HttpApi.Host'URL
  • User Avatar
    0
    viswajwalith created

    abp generate-proxy -t js -m userTaskService -url HttpApi.Host'URL

    Finally we are able to see some progress (not 100%) able to run the generate proxy

    but still not able to see the the new service related proxies in the main solution(base problem)

    still missing in definitions as well

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Well, the client proxy you see is actually I think it should be dynamic client proxy.

    See: https://docs.abp.io/en/commercial/latest/startup-templates/microservice/add-microservice#updating-administration-microservice

    Did you add the module dependency to AdministrationServiceHttpApiHostModule?

  • User Avatar
    0
    viswajwalith created

    Hi,

    Well, the client proxy you see is actually I think it should be dynamic client proxy.

    See: https://docs.abp.io/en/commercial/latest/startup-templates/microservice/add-microservice#updating-administration-microservice

    Did you add the module dependency to AdministrationServiceHttpApiHostModule?

    Yes we followed all the steps to add the micro service and changes in AdministrationServiceHttpApiHostModule is as follows

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Did you add the UserTaskServiceHttpApiClientModule module dependency to the Web app?

    For example:

    I can help you remotely if still not working. shiwei.liang@volosoft.com

  • User Avatar
    0
    viswajwalith created

    shiwei.liang@volosoft.com

    Yes we modified the web module as well. You want to connect over Microsoft teams ? or u can send the invite to viswajwalith@exceego.com

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Please email me when you have time,

    BTW, You can also share a project that can reproduce the problem with me shiwei.liang@volosoft.com, I will check it out.

  • User Avatar
    0
    viswajwalith created

    Hi,

    Please email me when you have time,

    BTW, You can also share a project that can reproduce the problem with me shiwei.liang@volosoft.com, I will check it out.

    I shared the project files to your email shiwei.liang@volosoft.com , Please have a look and let us know if u face any issues in downloading the file

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can try this:

    1

    Run the abp generate-proxy -m userTaskService -t csharp -url https://localhost:44377 --without-contracts command on the Exceego.EHSWatch.AppV3.UserTaskService.HttpApi.Client project

    2

    Open the UserTaskServiceHttpApiClientModule class and change AddHttpClientProxies to AddStaticHttpClientProxies

    You can see it's working:

  • User Avatar
    0
    viswajwalith created

    abp generate-proxy -m userTaskService -t csharp -url https://localhost:44377 --without-contracts

    Thanks for the inputs, it got succussed partially when I executed Step 1: proxies got generated only for Sample Controller

    files generated with the step 1 command.

    Proxies got generated but only with Sample Controller method

    I tried by running

    abp generate-proxy -m userTaskService -t csharp -url https://localhost:44377
    

    without the parameter --without-contracts but no luck.

    Also We would like to understand why dynamic proxies are not working

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Thanks for the inputs, it got succussed partially when I executed Step 1: proxies got generated only for Sample Controller

    There are two API definitions only uppercase and lowercase letters differ,

    You can try -m UserTaskService

    Also We would like to understand why dynamic proxies are not working

    You have to reference the UserTaskService.HttpApi project and add module dependency to AppV3WebModule if you want to use dynamic proxies.

    Using dynamic proxies will make things easier, you don't have to generate static proxy files and can remove those files.

  • User Avatar
    0
    viswajwalith created

    Hi,

    Thanks for the inputs, it got succussed partially when I executed Step 1: proxies got generated only for Sample Controller

    There are two API definitions only uppercase and lowercase letters differ,

    You can try -m UserTaskService

    Also We would like to understand why dynamic proxies are not working

    You have to reference the UserTaskService.HttpApi project and add module dependency to AppV3WebModule if you want to use dynamic proxies.

    Using dynamic proxies will make things easier, you don't have to generate static proxy files and can remove those files.

    After couple of redoing from starting of creation of service, Now we are able to get the Proxies generated with dynamic proxies only and now js proxies are available

    and from webgateway the method is being called successfully as well

    but now getting some different error When we are trying to call the methods using AppService (IMasterDataObjectsAppService)

    getting the below error

    error log is below

    2023-04-24 08:31:08.942 +05:30 [INF] Executed page /MasterDataObjects/Index in 23651.965ms 2023-04-24 08:31:08.942 +05:30 [INF] Executed endpoint '/MasterDataObjects/Index' 2023-04-24 08:31:08.946 +05:30 [ERR] An unhandled exception has occurred while executing the request. Volo.Abp.AbpException: Could not found remote action for method: System.Threading.Tasks.Task1[Volo.Abp.Application.Dtos.PagedResultDto1[XXX.XX.XX.UserTaskService.MasterDataObjects.MasterDataObjectDto]] GetListAsync(XXX.XX.XX.UserTaskService.MasterDataObjects.GetMasterDataObjectsInput) on the URL: https://localhost:44325 at Volo.Abp.Http.Client.DynamicProxying.ApiDescriptionFinder.FindActionAsync(HttpClient client, String baseUrl, Type serviceType, MethodInfo method) at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.GetActionApiDescriptionModel(IAbpMethodInvocation invocation) at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed) at XXX.XX.XX.UserTaskService.Web.Pages.MasterDataObjects.IndexModel.OnGetAsync() in C:\Official\EHSWatchV3\repo\EHSWatch_AppV3Upgrade\services\userTask\src\XXX.XX.XX.UserTaskService.Web\Pages\MasterDataObjectsUT\Index.cshtml.cs:line 30 at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.NonGenericTaskHandlerMethod.Execute(Object receiver, Object[] arguments) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync() at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync() at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Rethrow(PageHandlerExecutedContext context) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeInnerFilterAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Sorry, I forgot one thing,

    You also need to reference the UserTaskService.HttpApi project and add module dependency to AppV3WebGatewayModule.

    And update the OnApplicationInitialization method of the AppV3WebGatewayModule class:

    public override void OnApplicationInitialization(ApplicationInitializationContext context)
    {
        .......
        
        //Add this
        app.MapWhen(
            ctx => ctx.Request.Path.ToString().StartsWith("/api/abp/api-definition") ||
                   ctx.Request.Path.ToString().TrimEnd('/').Equals(""),
            app2 =>
            {
                app2.UseRouting();
                app2.UseConfiguredEndpoints();
            }
        );
        app.UseRewriter(new RewriteOptions()
            // Regex for "", "/" and "" (whitespace)
            .AddRedirect("^(|\\|\\s+)$", "/swagger"));
        app.UseOcelot().Wait();
    }
    

    Update the ocelot.json to replace userTask-service with user-task-service

  • User Avatar
    0
    viswajwalith created
    //Add this 
    app.MapWhen( 
        ctx => ctx.Request.Path.ToString().StartsWith("/api/abp/api-definition") || 
               ctx.Request.Path.ToString().TrimEnd('/').Equals(""), 
        app2 => 
        { 
            app2.UseRouting(); 
            app2.UseConfiguredEndpoints(); 
        } 
    ); 
    app.UseRewriter(new RewriteOptions() 
        // Regex for "", "/" and "" (whitespace) 
        .AddRedirect("^(|\\|\\s+)$", "/swagger")); 
    app.UseOcelot().Wait(); 
    

    Thanks liangshiwei, it worked perfectly. In fact we added the user Task API in WebGateway and modified the octlog configuration but missed the below change mentioned.

    Can you guys please update the documentation to include the above steps. (https://docs.abp.io/en/commercial/latest/startup-templates/microservice/add-microservice) which might be helpful for others as well

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Ok, we will

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