I make one window service in c#
to run exe on particular time., but it could open that exe,
Below is code
private static string checkdatentime()
{
currentdate = DateTime.Now;
string value = "1";
for (int i = 0; i < xml_date.Count; i++)
{
value = "2";
if (currentdate.Date < xml_date[i].Date)
{
value = "3";
break;
}
else if (currentdate.Date > xml_date[i].Date)
{
value = "4";
}
else
{
value = "5";
if (currentdate.Date == xml_date[i].Date)
{
value = "99";
currentTime = currentdate.ToString("hh:mm");
TriggerTime = newItem.TriggerTime.ToString("hh:mm");
if (currentTime == TriggerTime)
{
value = "6";
System.Diagnostics.Process.Start("E:\\SqlBackup_Programs\\console-backup\\Backup_Console_App 22July Latest\\Backup_Console_App\\Backup_Console_App\\bin\\Debug\\Backup_Console_App");
return value;
}
}
}
}
return value;
}
NOTE: here I return value because to verify is my code runs correct or not and write VALUE on text file, so on same time I am getting VALUE=6, means there is no problem in code,
But still service cant open this exe,
by same code i made console application and its runs perfectly, so why not services??
Is this any problem with command,
System.Diagnostics.Process.Start();
kindly help me!!