How to "force" restart the nopcommerce server when saving values in configuration page?

10 месяцев назад
Hi, I am wondering how to "force" restart the nopcommerce server (4.60.3) when the admin changes and saves the values in the plugin configuration page. In the configuration page I have a couple of inputs where the admin has to insert an api url and api key, and in the nopStartup.cs file, I register a HttpClient service, which uses that url from the settings. So basically I want to prompt the user to restart the server to apply changes and that the service gets the new url.
Thanks
10 месяцев назад
See src\Presentation\Nop.Web\Areas\Admin\Controllers\CommonController.cs
  
        /// <summary>
        /// Restart application domain
        /// </summary>
        public virtual void RestartAppDomain()
        {
            _hostApplicationLifetime.StopApplication();
        }
10 месяцев назад
Hi, thank you for the reply. In the file you specified I found only this:
        public virtual async Task<IActionResult> RestartApplication()
        {
            if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageMaintenance) &&
                !await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManagePlugins) &&
                !await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageSettings))
            {
                return AccessDeniedView();
            }

            //restart application
            _webHelper.RestartAppDomain();

            return new EmptyResult();
        }

How do I call it in my configure page (in my controller)?
10 месяцев назад
Look how it has been done for "App settings" in admin area.