开发者

Server 2008 Task Scheduler Mapped Drive Access C#

I'm trying do get Server 2008's Task Scheduler to run a C# console app which backs up data to a mapped backup drive somewhere on FastHosts network.

I've written a test app which simply does this

Directory.CreateDirectory("Z:\" + DateTime.Now.Ticks.ToString());

i.e. just creates a directory on the root of this Z drive.

This works fine when I just run the .exe but when I schedule it in Task Scheduler it doesn't create the directory but says the task has completed with return code 3762507597 - I can't find any info on what this means.

I'm running the task with the highest Admin privelages as far as I can 开发者_Python百科see.


If this ever helps someone else, the issue I had was due to the 'action' needing to have the 'Start in' path set to the same path as the application itself. Otherwise I'm guessing it's trying to write to the system root.

A bit cryptic!


Not sure why is now works but I replaced the mapped drive letter i.e. 'Z' with the full name i.e. \[IP address]]\C$ and it now works.

Some weird permissions thing no doubt.


That looks like an AccessViolationException, so I assume you are not running under the correct credentials.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜