private void cargarServicio() { try { string path = ""; try { path = ConfigurationManager.AppSettings["ConfigDirectory"] != null ? ConfigurationManager.AppSettings["ConfigDirectory"].ToString() : ""; } catch (Exception ePath) { path = ""; Log.EscribeLog("Error al obtener el path desde appSettings: " + ePath.Message); } string PathDestino = ""; try { PathDestino = ConfigurationManager.AppSettings["PathDes"].ToString(); //Verificar Folder if (!Directory.Exists(PathDestino)) { Directory.CreateDirectory(PathDestino); } } catch (Exception ePATHDES) { Log.EscribeLog("Existe un error al leer el path de destino: " + ePATHDES.Message); } ClienteF2CResponse mdl = new ClienteF2CResponse(); if (File.Exists(path + "info.xml")) { _conf = XMLConfigurator.getXMLfile(); id_Servicio = _conf.id_Sitio; AETitle = _conf.vchAETitle; vchPathRep = _conf.vchPathLocal; vchClaveSitio = _conf.vchClaveSitio; if (id_Servicio > 0 && vchClaveSitio != "") { Token = Security.Encrypt(id_Servicio + "|" + vchClaveSitio); } } Log.EscribeLog("Sitio: " + vchClaveSitio); if (vchClaveSitio != "") { mdl = ConfigDataAccess.getConeccion(vchClaveSitio, id_Servicio); if (mdl != null || _conf != null) { if (!(id_Servicio > 0)) { id_Servicio = mdl.id_Sitio; } if (vchClaveSitio == "") { vchClaveSitio = mdl.ConfigSitio.vchClaveSitio; } if (AETitle == "") { AETitle = mdl.ConfigSitio.vchAETitle; } if (Token != "") { Token = Security.Encrypt(id_Servicio + "|" + vchClaveSitio); } Log.EscribeLog("Inicio de CargarServicio SCP"); // preload dictionary to prevent timeouts var dict = DicomDictionary.Default; int port = 0; Log.EscribeLog("Puerto: " + (mdl.ConfigSitio == null ? _conf.intPuertoCliente : mdl.ConfigSitio.intPuertoCliente)); Log.EscribeLog("AETitle: " + AETitle); // start DICOM server on port from command line argument or 11112 try { if (_conf.intPuertoCliente > 0) { port = _conf.intPuertoCliente; } else { if (mdl.ConfigSitio.intPuertoCliente > 0) { port = (int)mdl.ConfigSitio.intPuertoCliente; } else { port = Convert.ToInt32(ConfigurationManager.AppSettings["Puerto"].ToString()); } } } catch (Exception ePuerto) { Console.WriteLine("No se pudo leer el puerto especificado, favor de verificar.: " + ePuerto.Message); Log.EscribeLog("No se pudo leer el puerto especificado, favor de verificar.: " + ePuerto.Message); } if (port > 0) { Console.WriteLine($"Iniciando Servidor C-Store SCP en el puerto {port}"); var server = DicomServer.Create <CStoreSCP>(port); Log.EscribeLog($"Iniciando Servidor C-Store SCP en el puerto {port}"); ConfigDataAccess.setService(id_Servicio, vchClaveSitio); // end process Console.WriteLine("Oprimir <return> para finalizar..."); Console.ReadLine(); } else { Console.WriteLine("No se pudo leer el puerto especificado, favor de verificar."); Log.EscribeLog("No se pudo leer el puerto especificado, favor de verificar."); } } } else { Console.WriteLine("No se pudo encontrar los datos para la búsqueda de sitio. En espera de los datos de configuración."); Log.EscribeLog("No se pudo encontrar los datos para la búsqueda de sitio. En espera de los datos de configuración."); } } catch (Exception eLoadService) { Log.EscribeLog("Error al cargar el servicio: " + eLoadService.Message); } }