Ниже приведен код, написанный для оконных сервисов для копирования файлов.Он заканчивается строкой «JsonConvert.DeserializeObject> (jsonStirng);»
public static void copyfiles()
{
getLog("Before querying");
SqlDataReader reader = select();
if (reader.HasRows)
{
reader.Read();
string jsonStirng = reader["parameter"].ToString();
getLog("Found rows" + jsonStirng); // this will get log with values
try
{
var result = JsonConvert.DeserializeObject<List<RootObject>>(jsonStirng);
getLog("result =>" + result[0].FOLDER_NAME); // this ignore, if remove above line, this log will work.
// continue logic for copying files..
}
}
catch (Exception e)
{
getLog("Fail to copy files"+e);
}
}
else
{
getLog("No rows found.");
}
reader.Close();
}
Ниже приведен журнал, который я получаю
ID DATE THREAD LEVEL LOGGER MESSAGE
141 2019-05-22 17:09:02.273 Windows Services-Copy files INFO OS Found rows[{"FOLDER_TYPE":"UPLOAD_FOLDER","FOLDER_NAME":"UPLOAD_FOLDER\\"},{"FOLDER_TYPE":"DATA_FOLDER","FOLDER_NAME":"E:\\Suresh\\Projects\\TribandBISE\\BISE_C\\BISE_C\\DATA_FOLDER\\"},{"FOLDER_TYPE":"SOURCE_FOLDER","FOLDER_NAME":"SOURCE_FOLDER\\"},{"FOLDER_TYPE":"DB_BACKUP_FOLDER","FOLDER_NAME":"DATA_FOLDER\\DB_BACKUP_FOLDER"}]
140 2019-05-22 17:09:02.250 Windows Services-Copy files INFO OS inside select
139 2019-05-22 17:09:02.240 Windows Services-Copy files INFO OS Before querying
138 2019-05-22 17:09:02.230 Windows Services-Copy files INFO OS Code initiated
137 2019-05-22 17:09:02.220 Windows Services-Copy files INFO OS windows service Copy_Data_Files initiated
136 2019-05-22 17:05:40.353 Windows Services-Copy files INFO OS error in init windows service
135 2019-05-22 17:05:40.050 Windows Services-Copy files INFO OS Code initiated