Reputation: 23
I have an exe that developed on visual studio.
When we run it on the server, it will execute with out any issues.
But when I tried to execute it through Task scheduler, it is not running.
Please find the below error message from event viewer.
Please help me to resolve the issue
Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.IO.DirectoryNotFoundException Stack: at System.IO.__Error.WinIOError(Int32, System.String) at System.IO.Directory.InternalCreateDirectory(System.String, System.String, System.Object, Boolean) at System.IO.DirectoryInfo.Create() at CentralMarketTransfer.HEB.CentralMarketTransfer.util.SimpleLogging.LogMessageToFile(System.String) at CentralMarketTransfer.HEB.CenteralMarketTransfer.main.ProjectMain.Main(System.String[])
Upvotes: 2
Views: 2349
Reputation: 4322
Try to explicitly set the start directory for the task. You can set in Task Scheduler.
Select Task -> Right Click -> Properties -> Actions Tab -> Select Action -> Edit -> Start in (optional)
Upvotes: 4
Reputation: 1796
To me it seems that the current running directory is different when the exe is executed directly and when running through the task scheduler.
For reference:
What is the default working directory for a scheduled task in Windows 2008 R2?
Specifying the running directory for Scheduled Tasks using schtasks.exe
Upvotes: 1