473,466 Members | 1,413 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

VB.NET crashes when run from Windows scheduled tasks if user logged off

4 New Member
I have a VB.NET app that crashes when run from the Windows scheduled tasks, but runs fine when the run-as user is logged on. The app also runs fine from the scheduled jobs if the run as user is disconnected. The O/S is Windows Server 2003, the app is created with VB.NET 2003. The .NET framework is up todate with Windows releases. The APP opens connections to an SQL Server 2003 database and an ODBC sql connection to an iSeries database.

Unfortunatley the event viewer application message message is not very specific, please see below.

The scheduled task ending status is 0xc000013a, which implies "access denied". Apparently, the problem is due to not having permissions to access a needed object without the user being logged on.

But when I log on to attempt a debug, the app runs fine.

Is there a way to get a more specific message logged in the event view so that I have a clue as what the problem is?

We have tried running the task as an admin user, with the same results.
We added the specific user to Command.exe, still failed.
We added BATCH to the Command.exe object, still failed.

Thanks for your help
Weems


- - - Event View message
The description for Event ID ( 0 ) in Source ( .NET Runtime ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: .NET Runtime version 1.1.4322.2379- AutoImagePOI.exe - Common Language Runtime Debugging Services: Application has generated an exception that could not be handled.

Process id=0x158c (5516), Thread id=0x924 (2340).

Click OK to terminate the application.
Click CANCEL to debug the application..

MyBox .net: (version 1.1.4322.573)
Aug 10 '07 #1
7 9090
Plater
7,872 Recognized Expert Expert
Can you make your program run with the worker-process user credentials? Like the IUSER or something? Although if it didn't work as admin I'm not sure.

One thing I do know is that if the program is located on say computerA and you tell computerB to run that program located on ComputerA, you get access denied messages a-plenty.
I always have to run local copies for them to function.
Aug 10 '07 #2
whutto
4 New Member
Plater:
The program runs standalone with the user credentials in a command window and from the scheduled tasks as long as the user is logged on. But it will not run from the scheduled tasks if the user is logged off, even though the run-as user is the same..

Logging on seems to change the permissions available to the scheduled task, which I do not understand.

My problem is how to find out what specific object is generating the access denied messages.

Thanks
Weems
Aug 13 '07 #3
Plater
7,872 Recognized Expert Expert
Put in some try/catch blocks and have descriptive error messages, stacktrace and such?
Aug 13 '07 #4
TRScheel
638 Recognized Expert Contributor
My guess is that when it runs as system it is attempting to access something normally given a real user (my documents, etc) but not to the SYSTEM user. I would do as plater suggested above.
Aug 13 '07 #5
whutto
4 New Member
Thanks for the suggestions. I put in a subroutine that writes to a text file and used that at various points in the logic to pin down the problem.

The scheduled task cannot access the mapped network drive that has the image folders, but the program has permissions to do that when the user is logged on. I am working with SysAdmin to set the permissions to allow this to process.

Line 131 referenced in the message is
Dim finfo() As IO.DirectoryInfo = di.GetDirectories()
which attempts to access the network drive to get the path information.

Thanks again
Weems

The actual error message text is:
System.IO.DirectoryNotFoundException: Could not find a part of the path "L:\ImageArchive\ArchiveForms\".
at System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.Directory.InternalGetFileDirectoryNames( String fullPath, String userPath, Boolean file)
at System.IO.DirectoryInfo.GetDirectories(String searchPattern)
at System.IO.DirectoryInfo.GetDirectories()
at AutoImagePOI.Module1.Main(String[] sArgs) in C:\Documents and Settings\HP_Administrator\My Documents\Visual Studio Projects\AutoImagePOI\AutoImage.vb:line 131
Aug 13 '07 #6
TRScheel
638 Recognized Expert Contributor
Thanks for the suggestions. I put in a subroutine that writes to a text file and used that at various points in the logic to pin down the problem.

The scheduled task cannot access the mapped network drive that has the image folders, but the program has permissions to do that when the user is logged on. I am working with SysAdmin to set the permissions to allow this to process.

Line 131 referenced in the message is
Dim finfo() As IO.DirectoryInfo = di.GetDirectories()
which attempts to access the network drive to get the path information.

Thanks again
Weems

The actual error message text is:
System.IO.DirectoryNotFoundException: Could not find a part of the path "L:\ImageArchive\ArchiveForms\".
at System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.Directory.InternalGetFileDirectoryNames( String fullPath, String userPath, Boolean file)
at System.IO.DirectoryInfo.GetDirectories(String searchPattern)
at System.IO.DirectoryInfo.GetDirectories()
at AutoImagePOI.Module1.Main(String[] sArgs) in C:\Documents and Settings\HP_Administrator\My Documents\Visual Studio Projects\AutoImagePOI\AutoImage.vb:line 131
If probably doesnt exist for that user. I would do create a process object that ran 'net use L <location>' before trying to connect to it with a DirectoryInfo. There might be a way to do that in code though and not through the command line.
Aug 14 '07 #7
whutto
4 New Member
Worked with the sysadmin and we came up with a workaround. Rather than using a mapped network drive, ie
L:\ImageArchive\ArchiveForms\

we are using the network IP address to access the folders, ie:
\\192.168.1.22\e\ImageArchive\ArchiveForms\

I am surprised that there isn't a security issue with this, but it works without any problems.

The thing to remember in running a program from the Windows scheduled tasks is that the user's logon scripts have not executed and have not set up the mapped drives, desktop, etc for that specific user.

Thanks for everyone's input.
Weems
Aug 14 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Colin Steadman | last post by:
We have a number of scheduled tasks on our IIS server that run daily at some point during the early morning. These tasks run as a specific user that has the correct permissions to perform whatever...
11
by: Codemonkey | last post by:
Hi, I am writing an App in .Net that involves some scheduling of tasks. I was wondering if anybody has come accross any components or examples of how to implement a schedule manager like the one...
0
by: Satish | last post by:
Scheduled Tasks (.Net ) does not run when server is logged off (Windows 2003): I have a .net executable (command line exe) which performs certain business operations. I can run the program...
6
by: Krish | last post by:
I want to develop and application that run periodically in the server machine. Now Should I go for a windows service or just create a Console application and schedule it using the windows Task...
3
by: kj7ny | last post by:
How can I access and manipulate Scheduled Tasks in Windows using Python? I have a Windows XP workstation running Python 2.4.4 using the win32all modules to control the windows services on...
0
by: kkkanoor | last post by:
I am trying to schedule tasks in Windows from my C# program. The tasks get listed in Windows Schedule Tasks list, but it is not getting invoked. It seems I need to give the user name and password to...
5
by: rcook349 | last post by:
I want to run a piece of C# code at midnight every night that opens a file, changes something in it, and saves it. Would this be a Console Application set up as some sort of job? Would it be a...
1
by: oct08 | last post by:
Hi all, I'm trying to trouble shoot an issue where I am running an Access/VBA app, which grabs some data and puts it into a few text files. It usually takes 10 minutes to run (though after even a...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.