Search code examples
aspnetboilerplate

ABP Application Service method names ending in 'Async' are not being recognised in the client side calls


We recently upgraded from ABP 3.0 to ABP 6.3. During this process, we noticed that our Application Service method names ending in 'Async' are not being recognised in our JavaScript code. For example, a method called "CreateAsync" in our server side roles application service (RolesApplicationService) would need to be called as "create" without the 'Async' in the JavaScript for it to work.

Is there a way to revert back to the behaviour where we can use the full method names?


Solution

  • Yes, set RemoveAsyncPostfixOnProxyGeneration = false in your Web module:

    public override void PreInitialize()
    {
        Configuration.Modules.AbpWebCommon().ApiProxyScripting.RemoveAsyncPostfixOnProxyGeneration = false;
    }
    

    For ASP.NET Core, you may also need to set SuppressAsyncSuffixInActionNames = false in your Startup class:

    services.AddMvc(options =>
    {
       options.SuppressAsyncSuffixInActionNames = false; 
    });
    

    References: