【问题标题】:Client proxy returns a message "GetListAsync method was not found"Client proxy returns a message \"GetListAsync method was not found\"
【发布时间】:2022-12-02 04:12:38
【问题描述】:

Client proxy returns a message

The API description of the App.AdministrationService.Sequences.ISequencesAppService.GetListAsync method was not found!

However, when I looked up the json file AdministrationService-generate-proxy.json, I found an item.

"GetListAsyncByInput": {
  "uniqueName": "GetListAsyncByInput",
  "name": "GetListAsync",
  "httpMethod": "GET",
  "url": "api/administration-service/sequences",
  "supportedVersions": [],
  "parametersOnMethod": [
    { ....

Then the Repository looks this:

public interface ISequencesAppService : IApplicationService
{
    Task<PagedResultDto<SequenceDto>> GetListAsync(GetSequencesInput input);

    Task<SequenceDto> GetAsync(Guid id);

    Task DeleteAsync(Guid id);

    Task<SequenceDto> CreateAsync(SequenceCreateDto input);

    Task<SequenceDto> UpdateAsync(Guid id, SequenceUpdateDto input);
}

and the controller :

[RemoteService(Name = AdministrationServiceRemoteServiceConsts.RemoteServiceName)]
[Area("administrationService")]
[ControllerName("Sequence")]
[Route("api/administration-service/sequences")]
public class SequenceController : AbpController, ISequencesAppService
{
    private readonly ISequencesAppService _sequencesAppService;

    public SequenceController(ISequencesAppService sequencesAppService)
    {
        _sequencesAppService = sequencesAppService;
    }

    [HttpGet]
    public virtual Task<PagedResultDto<SequenceDto>> GetListAsync(GetSequencesInput input)
    {
        return _sequencesAppService.GetListAsync(input);
    } ...

I'm not sure what caused this error, but one thing I did was produce a CRUD from the abp suite, and everything was generated. Then I constructed a Static Client Proxy, and all of this is on the AdministrationService module.

I'm using a wpf client, thus I created a client proxy with csharp parameters.

The client module looks like:

[DependsOn(
    typeof(AdministrationServiceApplicationContractsModule),
    typeof(AbpPermissionManagementHttpApiClientModule),
    typeof(AbpFeatureManagementHttpApiClientModule),
    typeof(AbpSettingManagementHttpApiClientModule),
    typeof(AbpAuditLoggingHttpApiClientModule),
    typeof(LanguageManagementHttpApiClientModule),
    typeof(TextTemplateManagementHttpApiClientModule),
    typeof(AbpHttpClientModule)
)]
public class AdministrationServiceHttpApiClientModule : AbpModule
{
    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        context.Services.AddHttpClientProxies(
            typeof(AdministrationServiceApplicationContractsModule).Assembly,
            AdministrationServiceRemoteServiceConsts.RemoteServiceName
        );
        
        context.Services.AddStaticHttpClientProxies(
            typeof(AdministrationServiceApplicationContractsModule).Assembly,
            AdministrationServiceRemoteServiceConsts.RemoteServiceName
        );
    }
}

I did clean and rebuild the project many times and it still complaining.

【问题讨论】:

  • Without knowing abp but the url in your json does not fit the Route to the shown controller. The route ends in /sequences but your json points at /global-reference-configurations.
  • @Ralf - ohh nah sorry my mistake, I copied the wrong context. I'd updated the incorrect one.

标签: c# asp.net asp.net-core abp


【解决方案1】:

Just got to resolve this issue.

I've added this code on my ClientModule:

Configure<AbpVirtualFileSystemOptions>(options => {
   options.FileSets.AddEmbedded<BookStoreProxyModule>();
});

Then make the generate-proxy.json file as embed resource:

<ItemGroup>
    <EmbeddedResource Include="***generate-proxy.json" />
    <Content Remove="***generate-proxy.json" />
</ItemGroup>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-12-31
    • 2019-05-12
    • 2020-10-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-30
    相关资源
    最近更新 更多