(403) Forbidden when invoking a console application that generates a file

We have a simple console application that generates a TXT file and sends it as email to a list of users. This console application resides on a remote server on drive E. The console application is running; if i go to a remote server and i run it from command line a file is generated and an email is sent. Drive E is the local drive on the remote server.

Now I need to run the EXE from a web form, so I call it with System.Diagnostics.Process

and I deploy it to a remote server. Both Process.StartInfo.FileName

and WorkingDirectory

point to E: \. The code is on a button click, so I click the button and I get the error The remote server returned an error: (403) Forbidden

:

Process myProcess = new Process();
myProcess.StartInfo.FileName = @"cons.exe";
myProcess.StartInfo.UseShellExecute = true;
myProcess.StartInfo.WorkingDirectory = @"E:\apps\Program\CFolder";
myProcess.StartInfo.RedirectStandardInput = false;
myProcess.Start();

      

In my workstation, I have a mapping to drive E of RemoteServer (Y :). The code I'm using is exactly the same as above, but Y: \ instead of E :. So I am debugging locally and the file and letter are generated.

I understand it has to do with permissions, but what is the problem? It looks like in RemoteServer the web form at C: \ inetpub \ App \ Call.aspx cannot write to E: \ even though C: and E: are local drives and I added NETWORK SERVICE

and IIS_IUSRS

to a folder at E :.

I can include the code in the webform instead of calling the EXE, but I prefer to call the EXE since it already exists.

+3


source to share


1 answer


I ended up integrating the code with the website and removing the call to the console application.



0


source







All Articles