public void Register()
        {
            try
            {
                foreach (IApiIpcService apiIpcService in apiServices)
                {
                    Type interfaceType = GetInterfaceType(apiIpcService);

                    string serverName = GetCurrentInstanceServerName(modelMetadataService.ModelFilePath);

                    apiIpcServer?.Dispose();
                    apiIpcServer = new ApiIpcServer(serverName);

                    if (!apiIpcServer.TryPublishService(interfaceType, apiIpcService))
                    {
                        throw new ApplicationException($"Failed to register rpc instance {serverName}");
                    }

                    Log.Info($"Registered: {serverName}");
                }
            }
            catch (Exception e)
            {
                Log.Exception(e);
                throw;
            }
        }
Пример #2
0
 private void HandleCloseSolution(object sender, EventArgs e)
 {
     Log.Warn("Close solution");
     apiIpcServer?.Dispose();
     apiIpcServer = null;
 }