Starts in:
0 DAY
1 HR
2 MIN
13 SEC
Starts in:
0 D
1 H
2 M
13 S
Open Closed

Bootstrap WPF Client #68


User avatar
0
ididsbury created

Hi,

I'm developing a WPF client but I can't seem to initialise. I'm creating an application via the AbpApplicationFactory however when I call application.Initialize() the WPF client exits with code -42. I'm seeing a similar behaviour on the ConsoleTestApp where the following is written to the Console after calling application.Initialize().

info: Microsoft.Hosting.Lifetime[0] Application is shutting down...

I suspect I'm missing something with regards to hosting an ABP Application. Can you please confirm the best practice for hosting an ABP application within a WPF application.

Thanks

Ian


5 Answer(s)
  • User Avatar
    0
    alper created
    Support Team Director

    hi,

    it's easy! see this sample console application => https://github.com/abpframework/abp/tree/dev/samples/BasicConsoleApplication

  • User Avatar
    0
    ididsbury created

    Hi,

    Agreed. It seems straightforward. I was aware of the sample. It is similar to the ConsoleTestApp generated above. In my WPF app, I have the following:

            using (var application = AbpApplicationFactory.Create<DesktopClientModule>()) {
                application.Initialize();
    
                var helloWorldService = application.ServiceProvider.GetService<HelloWorldService>();
                helloWorldService.SayHello();
                
                application.Shutdown();
            }
    

    Once application.Initialize() is called the application immediately exits with code -42 (the hello world service is not executed). The exact same code in the ConsoleTestApp will result in the attached written to the console once application.Initialize() is called however the application will continue to run and the hello world service is executed.

    Could this be a bug? It seems that one of the core modules is calling application shutdown on initialisation. Could this be license related (I've had a few issues with reseting licenses) i.e. an application shutdown is called if a license check fails?

    Appreciate any help.

    Thanks

    Ian

  • User Avatar
    0
    ididsbury created

    Hi,

    Further to the above, I've created a new test WPF desktop client using the ABP framework (non commercial version) start-up template (Acme.BookStore). This works as expected so the shutdown issue most be licence related in the commercial version or an issue with one of the commercial modules.

    Can you please advise remedial actions.

    Thanks

    Ian

  • User Avatar
    0
    alper created
    Support Team Director

    Because you've forgotten to add your AbpLicenseCode to your WPF appsettings.json. Copy AbpLicenseCode to your appsettings.json.

  • User Avatar
    0
    ididsbury created

    Perfect. That solved it! Thanks for the support.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06