public int StartProcess()
        {
            int result = 1;
              #region Pobranie i walidacja konfiguracji procesu

              ITNWebServiceCfgNode config = ITNWebServiceCfgHelper.GetITNWebServiceCfg(core.ProcessConfigurationXml);

              if (String.IsNullOrEmpty(config.endpointAddress.Trim()))
            throw new Exception("Processing canceled - endpoint address empty.");

              #endregion Pobranie i walidacja konfiguracji procesu
              SqlDatabase dbPTRConfig = null;
              TaskInserter.core = core;
              TaskInserter.dbPTRConfig = ConverterUtils.GetDBConfig(core);
              TaskInserter.taskId = config.graphBeginNodeId;
              TaskInserter.runningTaskId = TaskInserter.lastRunningTaskId = ConverterUtils.GetRunningTaskId(core);
              TaskInserter.connectionString = ConverterUtils.GetDBConvertersConnectionString(core);
              if(config.longTimer<= config.shortTimer)
              {
            throw new Exception("Processing canceled - maximum delay is shorter than task delay.");
              }
              else if(config.shortTimer == 0)
              {
            throw new Exception("Processing canceled - delay cannot be zero.");
              }
              else if (config.longTimer == 0)
              {
            throw new Exception("Processing canceled - maximum delay cannot be zero.");
              }
              TaskInserter.shortTimer = new PtrTimer(TaskInserter.ShortTimerHandler, config.shortTimer * 1000);
              PTR3Core.LOG.Log(MsgStatusEnum.MS_Info, "Task delay {0} seconds.", config.shortTimer);
              TaskInserter.longTimer = new PtrTimer(TaskInserter.LongTimerHandler, config.longTimer * 1000);
              PTR3Core.LOG.Log(MsgStatusEnum.MS_Info, "Maximum delay {0} seconds.", config.longTimer);

              try
              {
            PTR3Core.LOG.Log(MsgStatusEnum.MS_Info, "Start processing");

            PTR3Core.DB_POOL.InitMSSqlPool(core, "database-converters");

            String endpointAddress = config.endpointAddress;
            PTR3Core.LOG.Log(MsgStatusEnum.MS_Info, "Endpoint address is {0}", config.endpointAddress);
            //endpointAddress = "http://localhost/ITNWebService"; //odkomentować przy testowaniu na lokalnym hoście
            string singleWsdl = ConfigXmlReader.XmlGetConfigParam(core, "single-wsdl");
            if (String.IsNullOrEmpty(singleWsdl))
              singleWsdl = ConfigXmlReader.XmlGetConfigParam(core.OptionalConfigurationXml, "single-wsdl");

            string locationWsdl = ConfigXmlReader.XmlGetConfigParam(core, "location-wsdl");
            if (String.IsNullOrEmpty(locationWsdl))
              locationWsdl = ConfigXmlReader.XmlGetConfigParam(core.OptionalConfigurationXml, "location-wsdl");

            Uri uri = new Uri(endpointAddress);

            if (uri.Scheme != "http")
            {
              throw new Exception("Endpoint address has wrong schema: " + uri.Scheme);
            }

            int start = Environment.TickCount;
            int i = 0;
            bool bWorking = true;

            WebServiceHost<ITNWebServiceContract> host = new WebServiceHost<ITNWebServiceContract>(endpointAddress);
            host.EnableMetadataExchange(true);
            ServiceEndpoint endpoint = host.AddServiceHttpEndpoint((Type)typeof(IITNWebServiceContract), "");
            if (singleWsdl == "1" || !String.IsNullOrEmpty(locationWsdl))
              endpoint.Behaviors.Add(new WCFExtras.Wsdl.WsdlExtensions(null
            , String.IsNullOrEmpty(locationWsdl) ? null : new Uri(locationWsdl)
            , singleWsdl == "1"));
            ServiceDebugBehavior behavior =
              host.Description.Behaviors.Find<ServiceDebugBehavior>();

            if(behavior != null)
            {
              behavior.IncludeExceptionDetailInFaults = true;
            }
            else
            {
              host.Description.Behaviors.Add(
              new ServiceDebugBehavior() { IncludeExceptionDetailInFaults = true });
            }
            host.Open();
            Thread.Sleep(500);
            if (dbPTRConfig == null)
              dbPTRConfig = ConverterUtils.GetDBConfig(core);
            while (PTR3Wrapper.ShouldClose() == 0 && PTR3Wrapper.ShouldSuspend() == 0 && host.State == CommunicationState.Opened && bWorking)
            {
              if ((i++ % 50) == 0)
              {
            //PTR3Core.LOG.Log(MsgStatusEnum.MS_Deb3, "Online wait processing...");

            bWorking = host.HeartBeat();
              }
              Thread.Sleep(100);
            }
            host.Close();
            Thread.Sleep(500);
            PTR3Core.LOG.Log(MsgStatusEnum.MS_Info, "Finish processing");
              }
              catch (Exception ex)
              {
            result = 0;
            PTR3Core.LOG.Log(MsgStatusEnum.MS_Error, ex, "");
              }

              return result;
        }