Pregunta

Fellow coders, I've built a WPF/ C# application (with .net 4), the app runs fine if debugging or even launching the ".exe" on its own, the app itself runs with Administrator privileges. While running with Administrator privileges I made it add itself as a Task in the "Task Scheduler". I've made sure the "Run with highest privileges" was checked while creating the task (and verified in the Task Scheduler that everything was set like it was supposed to)

When running the task, the task fails and I see this error: Task Scheduler failed to launch action "MYPATH\MyClient.Common.dll" in instance "{8df36ee7-0db9-4807-9b5d-d43a793f2169}" of task "\MyClient". Additional Data: Error Value: 2147942593.

I don't understand where this is coming from specially that the MyClient.Common.dll has nothing special; just some logging stuff and a few helpers. Here are the dlls MyClient.Common.dll is referencing:

  • Microsoft.CSharp
  • System
  • System.Core
  • System.Data
  • System.Data.DataSetExtensions
  • System.Management
  • System.Xml
  • System.Xml.Linq

I've tried looking for the error value: "2147942593" but no luck. Thank you in advance!

¿Fue útil?

Solución

Error code 2147942593 (hex 0x800700C1) is the HRESULT encapsulation of Windows error code C1, or ERROR_BAD_EXE_FORMAT.

(search for 0xC1 in http://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx)

In a task scheduler this often occurs in one of the following cases:

  1. The path points to a file that isn't an EXE program. If you literally entered the path to a DLL, this could be the cause.

  2. The path includes spaces and isn't quoted. See Why "schtasks" does not run my job?

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top