Open Closed

MAUI BLAZOR AbpInitializationException #5902


User avatar
0
ezarmer created
  • ABP Framework version: v7.3.3
  • UI Type: MAUI BLAZOR
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): NO
  • Exception message and full stack trace:
  • Volo.Abp.AbpInitializationException: 'An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module Volo.Abp.AspNetCore.Components.MauiBlazor.AbpAspNetCoreComponentsMauiBlazorModule, Volo.Abp.AspNetCore.Components.MauiBlazor, Version=7.3.3.0, Culture=neutral, PublicKeyToken=null: An error occurred during the ABP remote HTTP request. (Failed to connect to localhost/127.0.0.1:44321) See the inner exception for details.. See the inner exception for details.'
  • Steps to reproduce the issue:
    1. Create a new MAUI BLAZOR project.
    1. Seed database.
    1. Set startup projects to Api.Host and MAUIBlazor.
    1. Attempt to run using Android emulator.

I've spent all day yesterday trying to get this to work and was unable to do so. I did have ngrok also setup in the MAUI Blazor application which didn't make any difference. I have double and triple checked I have all requirements to run .MAUI installed. If I create a new MAUI HYBRID project from VS it works just fine. I thank you in advance for helping with this.


10 Answer(s)
  • User Avatar
    1
    enisn created
    Support Team .NET Developer

    It seems, your project can't access to localhost/127.0.0.1:44321 URL.

    If you use Android emulator, make sure you have just executed adb reverse tcp:44321 tcp:44321 command on adb terminal.

    Make sure you follow this documentation for each UI: https://docs.abp.io/en/commercial/latest/getting-started-maui#android

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    By the way, if you use ngrok or something equivalent, you have to make sure you just changed all the environment variables (appsttings.json) from localhost to your ngrok url and make data seeding before launching the AuthServer (if not tiered, HttpApi.Host)

  • User Avatar
    0
    ezarmer created

    I will attempt to try your recommendations here soon and reply back. I think I may have been following an older blog post. I was looking for documentation but couldn’t find what I was needing.

  • User Avatar
    0
    ezarmer created

    I attempted to follow the instructions. The error I have is as noted below.

    C:\abp reverse tcp:44384 tcp:44384

    ABP CLI 7.3.3 Unhandled exception. System.ArgumentException: Option names should start with '-' or '--'. at Volo.Abp.Cli.Args.CommandLineArgumentParser.ParseOptionName(String argument) in D:\ci\Jenkins\workspace\abp-volo-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Args\CommandLineArgumentParser.cs:line 107 at Volo.Abp.Cli.Args.CommandLineArgumentParser.Parse(String[] args) in D:\ci\Jenkins\workspace\abp-volo-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Args\CommandLineArgumentParser.cs:line 53 at Volo.Abp.Cli.CliService.RunAsync(String[] args) in D:\ci\Jenkins\workspace\abp-volo-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\CliService.cs:line 56 at Volo.Abp.Cli.Program.Main(String[] args) in D:\ci\Jenkins\workspace\abp-volo-release\abp\framework\src\Volo.Abp.Cli\Volo\Abp\Cli\Program.cs:line 43 at Volo.Abp.Cli.Program.<Main>(String[] args)

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    I attempted to follow the instructions. The error I have is as noted below.

    C:\abp reverse tcp:44384 tcp:44384

    ABP CLI 7.3.3 Unhandled exception. System.ArgumentException: Option names should start with '-' or '--'. at Volo.Abp.Cli.Args.CommandLineArgumentParser.ParseOptionName(String argument) in D:\ci\Jenkins\workspace\abp-volo-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Args\CommandLineArgumentParser.cs:line 107 at Volo.Abp.Cli.Args.CommandLineArgumentParser.Parse(String[] args) in D:\ci\Jenkins\workspace\abp-volo-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Args\CommandLineArgumentParser.cs:line 53 at Volo.Abp.Cli.CliService.RunAsync(String[] args) in D:\ci\Jenkins\workspace\abp-volo-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\CliService.cs:line 56 at Volo.Abp.Cli.Program.Main(String[] args) in D:\ci\Jenkins\workspace\abp-volo-release\abp\framework\src\Volo.Abp.Cli\Volo\Abp\Cli\Program.cs:line 43 at Volo.Abp.Cli.Program.<Main>(String[] args)

    No, it shouldn't be abp it should be adb (android debug bridge) and it's separated tool that is provided by android. You can easily find it in the visual studio in the following menu: Tools > Android > Android Adb Command Prompt

  • User Avatar
    0
    ezarmer created

    Maybe it would help if I had more coffee :-). I didn't even realize there was the Android Adb Command Prompt. I did run the command successfully. Per documentation, I did run the command after starting the emulator and it ran successfully. Thank you for the continued support. For others facing the same issue as myself, please follow @ensin advise step-by-step as well as check the documentation link for any updated instructions that may come with future releases.

  • User Avatar
    0
    ezarmer created

    The only issue I'm facing now is the hamburger menu doesn't display all of the menu options. It just displays home as seen below in the image.

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    It might be related to TokenProvider in the project.

    In the template, it register itself with default name but I found a problem with that logic.

    • Please make sure MauiBlazorAccessTokenStore class in your project have [ExposeServices(typeof(IAccessTokenStore))] attribute on it and implements ITransientDependency interface. As the final result it should be something like this:
    [Volo.Abp.DependencyInjection.Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(IAccessTokenStore))]
    public class MauiBlazorAccessTokenStore : IAccessTokenStore, ITransientDependency
    {
        // ...
    
    • Make sure MauiBlazorAccessTokenProvider class has also[ExposeServices(typeof(IAbpAccessTokenProvider))] attribute on it
  • User Avatar
    0
    ezarmer created

    It might be related to TokenProvider in the project.

    In the template, it register itself with default name but I found a problem with that logic.

    • Please make sure MauiBlazorAccessTokenStore class in your project have [ExposeServices(typeof(IAccessTokenStore))] attribute on it and implements ITransientDependency interface. As the final result it should be something like this:
    [Volo.Abp.DependencyInjection.Dependency(ReplaceServices = true)] 
    [ExposeServices(typeof(IAccessTokenStore))] 
    public class MauiBlazorAccessTokenStore : IAccessTokenStore, ITransientDependency 
    { 
        // ... 
    
    • Make sure MauiBlazorAccessTokenProvider class has also[ExposeServices(typeof(IAbpAccessTokenProvider))] attribute on it

    [Volo.Abp.DependencyInjection.Dependency(ReplaceServices = true)] [ExposeServices(typeof(IAccessTokenStore))] public class MauiBlazorAccessTokenStore : IAccessTokenStore

    I made the changes as requested and to no avail the same issue is present. Is there a way I can get someone to remote in and take a look? At this point it's really becoming a hindrance. I do understand you guys are trying to resolve the problem though.

  • User Avatar
    0
    joerguth created

    I have a similar problem that no menu items are loaded after successful login.

    The change to MauiBlazorAccessTokenStore was also made.

    According to the output, the authorization failed, apparently the IdentityClientConfiguration is missing: Maybe the problem of ezamer is based on the same issue.

    MauiBlazors output fom WindowsClient.

    Volo.Abp.IdentityModel.IdentityModelAuthenticationService: Warning: Could not find IdentityClientConfiguration for AbpMvcClient. Either define a configuration for AbpMvcClient or set a default configuration.

    System.Net.Http.HttpClient.AbpMvcClient.LogicalHandler: Information: Start processing HTTP request GET https://localhost:44375/api/abp/application-localization?CultureName=de-DE&OnlyDynamics=True&api-version=1.0 System.Net.Http.HttpClient.AbpMvcClient.ClientHandler: Information: Sending HTTP request GET https://localhost:44375/api/abp/application-localization?CultureName=de-DE&OnlyDynamics=True&api-version=1.0 System.Net.Http.HttpClient.AbpMvcClient.ClientHandler: Information: Received HTTP response headers after 7.2178ms - 200 System.Net.Http.HttpClient.AbpMvcClient.LogicalHandler: Information: End processing HTTP request after 11.5225ms - 200

    Microsoft.AspNetCore.Authorization.DefaultAuthorizationService: Information: Authorization failed. These requirements were not met: PermissionRequirement: SettingManagement.Emailing Microsoft.AspNetCore.Authorization.DefaultAuthorizationService: Information: Authorization failed. These requirements were not met: PermissionRequirement: SettingManagement.TimeZone Microsoft.AspNetCore.Authorization.DefaultAuthorizationService: Information: Authorization failed. These requirements were not met: PermissionRequirement: AbpAccount.SettingManagement Microsoft.AspNetCore.Authorization.DefaultAuthorizationService: Information: Authorization failed. These requirements were not met: PermissionRequirement: AbpIdentity.SettingManagement Microsoft.AspNetCore.Authorization.DefaultAuthorizationService: Information: Authorization failed. These requirements were not met:

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11