Open Closed

Blazor-Wasm-without-auto-discover-AppService-Proxies in runtime #8787


User avatar
0
mariovh created
  • ABP Framework version: v8.3.2
  • UI Type: Blazor WASM
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes

Hello,

I am experiencing severe startup delays in the WASM application once the WASM assemblies are loaded in the browser.

One of the options we are considering with my colleagues to improve the startup performance of the application after downloading the WASM file is to avoid generating proxies at runtime. Since reflection is costly in WebAssembly, this would save computation time and potentially eliminate the request to the api-definition endpoint, which also introduces a delay.

Would it be possible to generate these proxies at compile time instead?

In a Blazor solution, would this be complex or resource-intensive? Is there any command available in the ABP suite to achieve this?

What would be the recommended steps to follow to enable this feature?

Thank you for your support.


6 Answer(s)
  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Hello Mariovh,

    You can check our Static C# API Client Proxies document for this. https://abp.io/docs/latest/framework/api-development/static-csharp-clients

    Also, if you are having performance issues, I can recommend you to switch to Blazor WebApp from Blazor WASM. See differences: https://medium.com/@meghnav274/blazor-server-vs-blazor-webassembly-vs-blazor-web-app-8fe8fc1cefeb

    Here is the migrating document: https://abp.io/docs/9.0/release-info/migration-guides/abp-8-2-blazor-web-app

  • User Avatar
    0
    mariovh created

    Hello, I created a solution using the command:

    abp new Acme.BookStore -u blazor-webapp -m none --theme leptonx -csf

    After making changes to BookStoreHttpApiClientModule to use static clients, I ran the command to generate the clients, but I got the following error in the CLI (as shown in the image).

  • User Avatar
    0
    mariovh created

    Hello,

    I tried updating abp cli, same error:

    Thank you

  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    abp generate-proxy -t csharp -u https://localhost:44361/ -m YourModuleName

    You can get the modules on https://YourWebsite/api/abp/api-definition

    eg https://abp.io//api/abp/api-definition

  • User Avatar
    0
    mariovh created

    It works correctly, but if I load the application on a page that injects an IApplicationService, when the render mode is Server, it says that it is not registered.

    However, if I enter the application through the dashboard and, once the WASM is downloaded, I navigate to the page that has the IAppService, then in Client render mode, it works fine and correctly resolves the dependency injection.

  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Hi Mariovh,

    It works correctly, but if I load the application on a page that injects an IApplicationService, when the render mode is Server, it says that it is not registered.

    Your last question seems quite different from the initial one. Can you create a separate question for this topic?

    Thank you for your understanding.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.2.0-preview. Updated on March 20, 2025, 18:00