P
PMac
I'm trying to execute a stand-alone console application from an aspx page
when a use clicks a button on that page. On the aspx page is the following
lines of pertinent code:
private void btnStartApp(object sender, System.EventArgs e)
{
Process procID;
string procName;
ProcessStartInfo psi = new ProcessStartInfo();
procName=System.Configuration.ConfigurationSettings.AppSettings["Application
Name"].ToString();
psi.FileName = procName;
psi.Arguments="-noOp";
psi.WorkingDirectory=procName.SubString(0,procName.LastIndexOf('\\');
procID = Process.Start(psi);
}
In the console application that starts, it starts in the correct directory,
starts as user ASPNET, and gets the command line parameters fine, but
there's a line of code in the console app where it tries to read a
configuration string from the App.Config file. And it always fails on the
read and subsequently the application will fail because it doesn't have this
string value. I checked and the permissions on the working directory are
full for user ASPNET.
Where would the shell be looking for the App.Config file if not in the
working directory?
Does anyone have any experience with this to tell me why the console app is
not looking for the App.Config file in the working directory when it's run
like this as user ASPNET? It works fine when run from the command line in
"normal" mode.
Any thoughts/comments/help would be greatly appreciated ... I would hate to
have to just hard code the config string, it seems like you should still be
able to use the App.Config file for this time of run.
when a use clicks a button on that page. On the aspx page is the following
lines of pertinent code:
private void btnStartApp(object sender, System.EventArgs e)
{
Process procID;
string procName;
ProcessStartInfo psi = new ProcessStartInfo();
procName=System.Configuration.ConfigurationSettings.AppSettings["Application
Name"].ToString();
psi.FileName = procName;
psi.Arguments="-noOp";
psi.WorkingDirectory=procName.SubString(0,procName.LastIndexOf('\\');
procID = Process.Start(psi);
}
In the console application that starts, it starts in the correct directory,
starts as user ASPNET, and gets the command line parameters fine, but
there's a line of code in the console app where it tries to read a
configuration string from the App.Config file. And it always fails on the
read and subsequently the application will fail because it doesn't have this
string value. I checked and the permissions on the working directory are
full for user ASPNET.
Where would the shell be looking for the App.Config file if not in the
working directory?
Does anyone have any experience with this to tell me why the console app is
not looking for the App.Config file in the working directory when it's run
like this as user ASPNET? It works fine when run from the command line in
"normal" mode.
Any thoughts/comments/help would be greatly appreciated ... I would hate to
have to just hard code the config string, it seems like you should still be
able to use the App.Config file for this time of run.