Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to execute console application in task scheduler 1

Status
Not open for further replies.

DCSage

Programmer
Mar 5, 2010
74
US
Hello.

I created a console application (I don't need the actual window) which runs perfectly on my development box. But when I run the application on the production server, the process does not run.

I just copied the .exe file from the bin\Debug folder to a new folder on the Production Server.

I get the following error from the event viewer on production:

Code:
System.UriFormatException: Invalid URI: The format of the URI could not be determined.
   at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
   at System.Net.WebRequest.Create(String requestUriString)
   at FileCopy.uploadFile.Upload(String ftpServer, String userName, String password, String uplfile)
   at FileCopy.Program.UploadEdi()
   at FileCopy.Program.Main(String[] args)

the application uploads files, moves them to a folder and then writes the results of the process to a text file.

Why would I get an error on production, but not on development? Do I need to copy other files to the production folder? I placed just the executable so that the task scheduler could run. Could the window be creating the problem. How would I get rid of the actual window?

Please advise.



 
Does your URI being used by the application include an relative pathing?? Does the service account or account that the task scheduler is set to run as have all the necessary permissions??

My past experience has been this these are common issues. Checking the production box to make sure drive letter mappings are correct and that permissions are correct seems to be my problems more often than not.

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB.NET Programmer
 
Thanks for your quick response.

I figure this has something to do with permissions. The admin just gave me full rights to the production server, bu tthe problem persists.

Here's the breakdown on the files:

I mapped the servers that I need to move the files around:

A common string in program.cs looks like
Code:
string newfile = @"\\prodSerHQF01S\Dealmaker\EDI_TG\Sent to MSA\EDI Logs\EDI_Logs_" + cDate + ".txt";

the development box has the production server folder for the project mapped as a standard drive:

Code:
L:\EDI Test Automation (this is really prodSerHQF01S\Dealmaker\EDI Test Automation)


I didn't change anything for production, but I keep getting the URI error.


I placed my ftp information in the app.config file:
 
Hello.

I figured out that the error revolved around my paths. Although I had the server information in my initial development code, for some reason, the paths were creating conflicts on production.

I did the following in my code:

Code:
string srcDir = @"J:\\Dealmaker\EDI\";
string src = Path.GetDirectoryName(srcDir);

srcDir is the path on the Production server, since the drive was mapped.

Thank you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top