2

I have written a simple .NET Core console app (which writes some log files, hits a database and sends some emails). Triggering the task by double-clicking on the .exe within Windows works fine.

However when attempting to trigger the task through Task Scheduler it immediately fails with the code 0xC0000005. This failure happens when actually triggered on it's schedule or by right-clicking the task within the Task Scheduler app and clicking 'Run'. The first thing the app attempts to do is write something to a log file, which never happens.

The same server has a bunch of other .NET console apps (not .NET core) that are configured with exactly the same permissions and user accounts and they work fine.

In the event log there's a record that reads:

Faulting application name: StorePlay.ClientEmailer.exe, version:
1.1.0.1179, time stamp: 0x58224b03 Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000 Exception code: 0xc0000005
Fault offset: 0x00007ffaef1d8955 Faulting process id: 0xe0c Faulting
application start time: 0x01d301e534cdde90 Faulting application path:
C:\storePlay\Tasks\Client Emailer\StorePlay.ClientEmailer.exe Faulting
module path: unknown Report Id: 1bc8be44-744c-452e-a945-997d64d1d87b
Faulting package full name: Faulting package-relative application ID:

This is all on a machine running Windows Server 2016

  • Did you ever figure out the answer to this question, I am having the same problem and I tried to use my own credentials for the scheduled task – Breadtruck Jul 1 '18 at 5:11
5

I searched and tried all kinds of solutions and the one that worked for me was to set the Start In option. Normally someone could have the full path in the Program/Script text box after browsing, which is how most tasks I have seen run. It appears that .Net Core console app needs to run with the optional path so it can find the appsettings.json if you are using one.

https://stackoverflow.com/questions/43595119/schedule-a-net-core-console-application-on-windows-using-task-scheduler

enter image description here

  • 2
    I joined this community only to upvote that answer. 4h searching – Pier Giorgio Misley Feb 12 '19 at 13:30
  • same here, just one thing to specify, in Program/scipt textbox, just keep the name of the program not the whole path, when I was trying, I just copied that path and pasted in the "Start" textbox and it wasn't working, may be helpful for some other dumb like me – Mohammed Dawood Ansari Jun 27 '19 at 5:06
3

It could be that the error is because of permissions. Usually the taskscheduler runs a task with the system account and when you run the exe in usual way on windows, then you run it with your credentials. You should be able to set your credentials on the task it self under task scheduler or create a user that has the permissions that it needs.

Edit: Did not see the age of the question until after posting an answer, but if it helps anyone else, then great :)

  • Hi Setorica and welcome to ServerFault. Yes, around here we're in fact more concerned with general answers, good for everyone experiencing a similar problem. – kubanczyk May 8 '18 at 15:27
  • how to set permissions in task scheduler? where to find that setting? I created an administrator user and set for my scheduler but still get same error as above in question. – Jitendra Pancholi Jan 12 '19 at 12:05
  • When you create a task in the task scheduler, then in the General tab, there should be settings for Security Options, where you can change which user account should run this task. Also you can set if it should be run as elevated/admin by checking the 'Run with highest privileges' checkbox. – Setorica Jan 13 '19 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.