abp icon indicating copy to clipboard operation
abp copied to clipboard

Error when use two static client proxies in one project

Open yaroslav-metelev opened this issue 5 months ago • 3 comments

Is there an existing issue for this?

  • [ ] I have searched the existing issues

Description

I get exception when use multiple static proxies with default RootPath in one C# project

Reproduction Steps

I have two projects ApiOne and ApiTwo where I generate static proxies for C# using default settings, as described in docs:
https://abp.io/docs/latest/framework/api-development/static-csharp-clients#without-contracts-example
I don't configure RootPath for conventional controllers, so it is "app" by default, as stated in docs:
https://abp.io/docs/latest/framework/api-development/auto-controllers#route

Both generated static proxies contains file app-generate-proxy.json that looks like this:

{
    "modules": {
        "abp": {
            // ..............
        },
        "app": {
            // ..............
        }
    }
}

When I use both static proxies simultaneously in my client project I have the following error:

Volo.Abp.AbpException: The API description of the ApiOne.Services.IHomeAppService.Test1Async method was not found!
   at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.BuildHttpProxyClientProxyContext(String methodName, ClientProxyRequestTypeValue arguments)
   at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync[T](String methodName, ClientProxyRequestTypeValue arguments)
   at AppBuilder.ProxyAbp.Services.HomeClientProxy.Test1Async() in ApiOne.HttpApi.ClientStatic\ClientProxies\HomeClientProxy.Generated.cs:line 22

Expected behavior

Multiple static proxies should work without custom RootPath configuration

Actual behavior

When I use both static proxies simultaneously in my client project I have the following error:

Volo.Abp.AbpException: The API description of the ApiOne.Services.IHomeAppService.Test1Async method was not found!
   at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.BuildHttpProxyClientProxyContext(String methodName, ClientProxyRequestTypeValue arguments)
   at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync[T](String methodName, ClientProxyRequestTypeValue arguments)
   at AppBuilder.ProxyAbp.Services.HomeClientProxy.Test1Async() in ApiOne.HttpApi.ClientStatic\ClientProxies\HomeClientProxy.Generated.cs:line 22

Regression?

Not that know of

Known Workarounds

Both static proxies will work simultaneously only if I configure different RootPath for ApiOne and ApiTwo projects:

Configure<AbpAspNetCoreMvcOptions>(options =>
{
    options.ConventionalControllers.Create(typeof(ProxyAbpApplicationModule).Assembly, opts =>
    {
        opts.RootPath = "ApiOne"; // "ApiTwo";
    });
});

Version

8.3.1

User Interface

Common (Default)

Database Provider

EF Core (Default)

Tiered or separate authentication server

None (Default)

Operation System

Windows (Default)

Other information

No response

yaroslav-metelev avatar Aug 12 '25 04:08 yaroslav-metelev

hi

Configure the RootPath is the right way.

maliming avatar Aug 12 '25 04:08 maliming

The point is if I can't change RootPath in some api projects that I don't control and changing RootPath is "breaking change" sometimes. Dynamic proxy work fine even with default RootPath by the way

yaroslav-metelev avatar Aug 12 '25 05:08 yaroslav-metelev

hi

Can you share these three projects?

Thanks.

maliming avatar Aug 12 '25 05:08 maliming