简体   繁体   中英

Server-side application fails to run command

I have an ASP.NET application that is already deployed in an Azure virtual machine. The situation is as follows:

This application, OCREngine , is deployed on the server along with other 3rd party applications. OCREngine is executed on the server by using a service reference to the web service. It runs fine most of the time. But there is one exception: one of the branches of execution won't run the program it needs to run. Both of the branches have to run a program (both are being run in the same way), but one works and the other one doesn't.

This one works: CleanJPEG.exe

proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "CleanJPEG.exe";
proc.StartInfo.Arguments = "\"" + tempPages + "Color Info.JPEG\"";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.Start();

And this one doesn't: cpctool.exe

proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "cpctool.exe";
proc.StartInfo.Arguments = "\"" + file + "\" -o \"" + tempPages + "page.tiff\"";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.Start();

They are both in the same folder, which has full permissions for the AppPool and so does %TEMP%.

If I run the application from the server, everything works fine. But when I run it through the web service, an instance of cpctool.exe gets created (can be seen on Background processes in the task manager) but it doesn't do it's job. And thus the execution of OCREngine never finishes.

This last part is what made me think it was a problem with permissions, but I don't know what else to give permissions to.

I run Folder Changes View on cpctool.exe and it showed access to the folder where the files are stored and one file being saved in %TEMP% (which, funny enough, doesn't appear when running Folder Changes View on the server).

Can anyone think of any special folder that needs permission that I might be forgetting?

You are completely correct to concentrrate on the permissions as that is usually the issue.

If an EXE process starts and does nothing, then it's probably only made for interactive use, and is prompting for something.

Looking at this page it says:

The FIRST TIME the CPCTool.exe runs the user is prompted to read/accept a User Agreement from Cartesian – this agreement MUST be accepted or the converter will not work.

I reckon that's what it's doing. Try logging in as the application pool user, start the program and accept the agreement.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM