Dear sir,
i got a TFT device attendance 3.5 inch and iam using SDK 6.2.4.11 iam using windows 10 LTSC Enterprize 64 bit
when running , i created a windows service on it when i try to run it, it does not work and cause an error 1053 :Error 1053: "The service did not respond in a timely fashion ... ,is there any conflict between windows 10 Enterprize and the SDK that i am using
i attach my service that iam registering to windows 10 64 bit Enterprize(64 bit) i try it on windows 10 pro-64 bit (my personal computer) and it is working , is there any prerequisite files should i install on the client computer(where the problem occurs)

also i attach the sdk iam using , iam deploying the service on my personal computer and run it on the client computer

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Timers;
using System.IO;
using System.Threading.Tasks;
using Oracle.ManagedDataAccess.Client;
using Oracle.ManagedDataAccess;
using zkemkeeper;

namespace Att_Service2
{
    public partial class Service1 : ServiceBase
    {
        //Timer timer = new Timer();
        //public zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();
        //public zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();
        //ZkSoftwareEU.CZKEUEMNetClass axCZKEM1 = new ZkSoftwareEU.CZKEUEMNetClass();
        zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();        
        private bool bIsConnected = false;//the boolean value identifies whether the device is connected
        private int iMachineNumber = 1;//the serial number of the device.After connecting the device ,this value will be changed.
        ServiceController service = new ServiceController("Atten_Service2");
        Timer timer = new Timer(); // name space(using System.Timers;)  
        //string IP = "192.168.0.201";
        //int Port = 4370;
        string sdwEnrollNumber = "";
        int idwTMachineNumber = 0;
        int idwEMachineNumber = 0;
        int idwVerifyMode = 0;
        int idwInOutMode = 0;
        int idwYear = 0;
        int idwMonth = 0;
        int idwDay = 0;
        int idwHour = 0;
        int idwMinute = 0;
        int idwSecond = 0;
        int idwWorkcode = 0;

        int idwErrorCode = 0;
        int iGLCount = 0;
        int iIndex = 0;
       // string TNS = "DATA Source=192.168.0.2:1521/ORCL;USER ID=PROKEM;Password=PROKEM";
        //     string       TNS1 = "DATA Source=136.243.14.106:1521/ORCL;USER ID=ELMASSALLA;Password=ELMASSALLA";

        public Service1()
        {
            InitializeComponent();
        }
        protected override void OnStart(string[] args)
        {
            // WriteToFile("Service is started at " + DateTime.Now);
            timer.Elapsed += new ElapsedEventHandler(OnElapsedTime);
            timer.Interval = 600000; //100 seconds instead of 10 seconds   --
            timer.Enabled = true;


        }
        protected override void OnStop()
        {
            // WriteToFile("Service is stopped at " + DateTime.Now);
        }

        public void sendToOracle(int iMachineNumber, string sdwEnrollNumber, int verifyMode, DateTime Date, OracleConnection ora)
        {
            int c1;
            string ID;
            int Code;
            c1 = iMachineNumber;
            ID = sdwEnrollNumber;
            Code = verifyMode;
            DateTime ATT;
            ATT = Date;
            OracleCommand oracmd = new OracleCommand();
            oracmd.CommandText = "insert into TA_ATTENDANCE_SHEET_LOG(c1,ID,Code,ATT) values(:c1,:ID,:Code,:ATT)";
            oracmd.Connection = ora;
            try
            {
                //ora.Open();
                // MessageBox.Show("Connection Successfully");
                oracmd.Connection = ora;  //must take open connection
                oracmd.Parameters.Add(":c1", c1);
                oracmd.Parameters.Add(":ID", ID);
                oracmd.Parameters.Add(":Code", Code);
                oracmd.Parameters.Add(":ATT", ATT);
                oracmd.ExecuteNonQuery();
                //  MessageBox.Show("data inserted successfully");
                //DataTable dt = new DataTable();
                //OracleDataAdapter da = new OracleDataAdapter("select * from  Dummy", ora);
                //da.Fill(dt);
                //dataGridView1.DataSource = dt;
                WriteToFile("Data inserted successfully  at " + DateTime.Now);

                oracmd.Dispose();

            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message.ToString());
                WriteToFile(ex.Message+" at "+ DateTime.Now +"  Fail to insert in table");
            }

        }//end function 

        public void WriteToFile(string Message)
        {
            string path = "C:\\Logs";
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            //AppDomain.CurrentDomain.BaseDirectory +
            string filepath =  "C:\\Logs\\ServiceLog_" + DateTime.Now.Date.ToShortDateString().Replace('/', '_') + ".txt";
            if (!File.Exists(filepath))
            {
                // Create a file to write to.   
                using (StreamWriter sw = File.CreateText(filepath))
                {
                    sw.WriteLine(Message);
                }
            }
            else
            {
                using (StreamWriter sw = File.AppendText(filepath))
                {
                    sw.WriteLine(Message);
                }
            }
        }

        private void OnElapsedTime(object source, ElapsedEventArgs e)
        {
            //zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();
            //ZkSoftwareEU.CZKEUEMNetClass axCZKEM1 = new ZkSoftwareEU.CZKEUEMNetClass();  update 
            //IP =
            string TNS;
            string IP;
            //////////////////update 1-9-2020   to read from text file the Attendance Machine IP and the connection string 
            //data in file should be like 
            //DATA SOURCE = 192.168.2.240:1521 / ORCL; USER ID = ASCON; Password = ASCON-192.168.2.74-
            string totalData = File.ReadAllText(@"c:\Data\Att1.txt"); //read information for attendance Machine1 

            try
            {
                //int index = totalData.IndexOf("-");
                //TNS = totalData.Substring(0, index - 1);
                //IP = totalData.Substring(index+1,totalData.Length-1);
                int index = totalData.IndexOf("-");
                int lastindex = totalData.LastIndexOf("-");
                int IPlength = lastindex - index - 1;
                TNS = totalData.Substring(0, index).ToString().Trim();
                IP = totalData.Substring(index + 1, IPlength).ToString().Trim();
                ///TNS = "DATA SOURCE = 192.168.2.240:1521 / ORCL; USER ID = ASCON; Password = ASCON";
                // IP = "192.168.2.74";
                //MessageBox.Show(TNS + "    " + IP);
                ///TNS = "DATA SOURCE = 192.168.2.240:1521 / ORCL; USER ID = ASCON; Password = ASCON";
                // IP = "192.168.2.74";

            }
            catch (Exception ex) { WriteToFile("No file exist or revise the format to be like  DATA SOURCE = 192.168.2.240:1521 / ORCL; USER ID = ASCON; Password = ASCON-192.168.2.74-   the file path is  c:\\data\\Att1.txt");return;}



            /////////////////////////////////////////////////////////////////////////////////////

           //uncomment this OracleConnection ora = new OracleConnection(TNS);
            //uncomment this OracleDataAdapter ODA;// = new OracleDataAdapter();
            DataTable dt = new DataTable();
            DataTable All_Data = new DataTable();
            string sdwEnrollNumber = "";
            int idwTMachineNumber = 0;
            int idwEMachineNumber = 0;
            int idwVerifyMode = 0;
            int idwInOutMode = 0;
            int idwYear = 0;
            int idwMonth = 0;
            int idwDay = 0;
            int idwHour = 0;
            int idwMinute = 0;
            int idwSecond = 0;
            int idwWorkcode = 0;
            int idwErrorCode = 0;
            int iGLCount = 0;
            int iIndex = 0;

            int Port = 4370;
            bool bIsConnected;
            int iMachineNumber = 1;
            string insertSQL;

            try
            {

              //  ora.Open();
              //  WriteToFile("Connected to Oracle Server " +DateTime.Now);
            }
            catch (Exception ex) { WriteToFile(ex.Message.ToString()+"  "+TNS); return; }

            //1-Oracle Connection 
            //                // uncomment OracleConnection ora = new OracleConnection(TNS);
            //                //uncomment OracleCommand oracmd = new OracleCommand();


            //2-MAchine Connection 

            try
            {
                //bIsConnected = axCZKEM1.Connect_Net(IP, Port);
                //if (bIsConnected == true)
                //{
                //    WriteToFile("Connected to attendance "+IP + DateTime.Now);
                //    //                    //btnConnect.Text = "DisConnect";
                //    //                    //btnConnect.Refresh();
                //    //                    //lblState.Text = "Current State:Connected";
                //    iMachineNumber = 1;//In fact,when you are using the tcp/ip communication,this parameter will be ignored,that is any integer will all right.Here we use 1.
                //    axCZKEM1.RegEvent(iMachineNumber, 65535);//Here you can register the realtime events that you want to be triggered(the parameters 65535 means registering all)

                //}


            }
            catch (Exception ex)
            {
                WriteToFile("Fail to connect to attendance Machine"+IP+":"+Port + DateTime.Now);


            }
            //3- Get Data From Attandance Machine

            try  ///////////today
            {  ////////////////today
                while (axCZKEM1.Connect_Net(IP, Port) != true) ;//****New check connection TCP
                WriteToFile("Connected to attendance "+DateTime.Now.ToString());

                //axCZKEM1.RefreshData(iMachineNumber);//********New 
                axCZKEM1.EnableDevice(iMachineNumber, false);//disable the device today
                WriteToFile("Device Disabled " + DateTime.Now.ToString());
                while (axCZKEM1.ReadAllGLogData(iMachineNumber) != true) ;//**New i added a loop instead of if (axCZKEM1.ReadGeneralLogData(iMachineNumber)) also ch
                                                                  //also changed the Read Generallog to read log
                                                                  //{
                WriteToFile("Begin Loop " + DateTime.Now.ToString());
                while (axCZKEM1.SSR_GetGeneralLogData(iMachineNumber, out sdwEnrollNumber,out idwVerifyMode,
                                out idwInOutMode, out idwYear, out idwMonth,out  idwDay, out  idwHour, out idwMinute, out idwSecond, ref idwWorkcode))//get records from the memory
                    {
                        //                        //insert into Oracle DB 
                        DateTime Date = Convert.ToDateTime(idwYear.ToString() + "-" + idwMonth.ToString() + "-" + idwDay.ToString() + " " + idwHour.ToString() + ":" + idwMinute.ToString() + ":" + idwSecond.ToString());
                    //  WriteToFile(Date);
                    //MessageBox.Show(iMachineNumber + "-" + sdwEnrollNumber + "-" + Date);
                    /*Commented on 18-7-2020 
                    WriteToFile(iMachineNumber+"-"+ sdwEnrollNumber+"-"+ idwInOutMode+"-"+ Date);
                    ODA = new OracleDataAdapter("select  *  from  dummy where ID='"+ sdwEnrollNumber + "' and ATT='"+Date+"'", ora);
                    ODA.Fill(dt);
                    if(dt.Rows.Count<1)
                    sendToOracle(iMachineNumber, sdwEnrollNumber, idwInOutMode, Date, ora);
                    dt.Clear();
                      */
                    //     MessageBox.Show("inserted Successfully");

                    //18-7-2020 Added 
                    /////TA_ATTENDANCE_SHEET_LOG

                    //test -send the data to oracle without any checking 14-10-2020
                    //sendToOracle(iMachineNumber, sdwEnrollNumber, idwInOutMode, Date, ora);

                    //if(Convert.ToInt16( sdwEnrollNumber)==14476)
                    try
                    {
                      //  if (Convert.ToInt16(sdwEnrollNumber) == 14476)
                            WriteToFile(iMachineNumber + " " + sdwEnrollNumber + " " + idwInOutMode + " " + Date);
                        //else WriteToFile("");
                    }
                    catch (Exception ex) {
                        //WriteToFile("Fail to Write to File...");
                        //if (!(service.Status.Equals(ServiceControllerStatus.Stopped)) ||!(service.Status.Equals(ServiceControllerStatus.StopPending)))
                        //              service.Start();
                        // if(service.Status==ServiceControllerStatus.Running)  service.Stop();
                        WriteToFile("Exception");

                    }
                    /* i commented this part to send the data direct to Oracle 14-10-2020
                      try
                          {
                              WriteToFile("begin checking dummy table for redundancy data...");
                              ODA = new OracleDataAdapter("select * from TA_ATTENDANCE_SHEET_LOG where ID='" + sdwEnrollNumber + "'", ora);
                              if (All_Data.Rows.Count > 0) All_Data.Clear();
                              ODA.Fill(All_Data);//this is one record
                          }
                          catch (Exception ex) { WriteToFile(ex.Message.ToString() + " at " + DateTime.Now); }

                          ////pass the datatable to the funtion checkifexist to check the timestamp also 
                          int val = Checkifexist(ora, sdwEnrollNumber, Date, All_Data);
                          WriteToFile("value of redundancy " + val.ToString());
                          if (val == 0)
                          {
                              sendToOracle(iMachineNumber, sdwEnrollNumber, idwInOutMode, Date, ora);
                          }

                         */

                }//end while
                WriteToFile("End Of while loop");
                axCZKEM1.EnableDevice(iMachineNumber, true);
                axCZKEM1.Disconnect();//***New
                  //uncomment this  ora.Close();
               // }


     //           else
       //         {
                    //                    // MessageBox.Show("Error in reading Data ");           
                    /// ///  WriteToFile("Service Error " + DateTime.Now);
      //          }



            }
          catch (Exception ex)
          {
                if (service.Status == ServiceControllerStatus.Running) service.Stop();
                WriteToFile("error " + ex.ToString()+ " at "+DateTime.Now.ToString() );
          }//today


        }//end function 
        public int Checkifexist(OracleConnection ora, string EnrollNum, DateTime dt, DataTable All_data)
        {
            OracleCommand oracmd = new OracleCommand();
            OracleDataReader DR;
            DataTable dt1 = new DataTable();

            string d;
            foreach (DataRow dr in All_data.Rows)
            {
                d = dr["ATT"].ToString(); //the ATT column - Date column-



                if (!Convert.ToBoolean(d.CompareTo(dt.ToString())))
                {
                    WriteToFile("Added new log:"+EnrollNum+" at "+d.ToString());      
                    return 1; //the value exists   in ORacle
                }

            }
            return 0; //the value does not exist
        }




    }//end class
}//end namespace`
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.