System.Diagnostics.Process & Dual-Server Environment

W

Will Asrari

In my code I have created a Process for opening up a command line
executable using System.Diagnostics.Process that imports a csv full of
Generic Authorization account information to numerous tables (SQL). When
the executable resides on the same server as my application the import
works fine. When my application is executed a new text file is created
in the folder listed below. The process arguments ent=1 and store=1 know
to look in ent001/store001 for the import file. I know it is possible to
create and open a file in a single-server environment as I have tested
this. What would I need to do (permissions, sharing, etc...) to allow
the creation and importation of the csv file in a dual-server
environment? The servers will always be on the same network.

Thanks in advance,

- Will

...
// write CSV file
TextWriter tw = new
StreamWriter(@"\\server\ent001\store001\ga_imp2.txt", false,
UnicodeEncoding.Default);
tw.WriteLine(yada + "," + yada + "," + yada);

ImportGA();

private void ImportGA()
{
Process proc = new Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.Arguments = "/Ent=1 /Store=1";
proc.StartInfo.WorkingDirectory = @"\\server\share\sys_exe";
proc.StartInfo.FileName = "ga_imp2.exe";

try
{
proc.Start();
}

catch(Exception ex)
{
GCM.Reference.UpdateLogFile(ex.ToString());
}

finally
{
proc.Close();
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,133
Latest member
MDACVReview
Top