theSpringer

Hi all,

I'm trying to run an executable.

On my testing envirment everything works fine, but on the server (windows server 2003) nothing happens.

I use the same code and the same file !

the code i'm using is:

Process process = new Process();

process.StartInfo.FileName = m_strCompilerExecutable;

process.StartInfo.UseShellExecute = true;

process.StartInfo.WorkingDirectory = m_strCompilerFolder;

process.Start();

any help will be appreciated !

thanks in advance,

theSpringer.



Re: Visual C# General process does not execute

Peter Ritchie

You get no exception

What is the return value from process.Start()






Re: Visual C# General process does not execute

theSpringer

I get no exception.

the return value from process.Start() is True





Re: Visual C# General process does not execute

Citizen on the earth

Hi theSpringer,

Did you run the process on IIS of Windows Server 2003 If this is right, as far as I know, a process can only run at the background in asp.net 2.0 websites when it is deployed on IIS, but it can't interact with the desktop application. If you run a process in a website by asp.net internal debugging web server,it can run fine.This is by design.

Hope this helps,

Citizens on the earth





Re: Visual C# General process does not execute

Peter Ritchie

If there is no exception and the return value is True, the application executed. If the application implements a singleton pattern for itself in that it will allow only one instance to run at a time, it may be reusing another instance and exiting right away.

Maybe you can provide more detail about the environment you're running your application in






Re: Visual C# General process does not execute

theSpringer

Hi,

Thanks guys for your replies.

I'm running my WS on windows server 2003.

I found out that the problem is permission problem. something to do with windows server 2003 configurations.

The problem i have now, is that the exe im trying to run, through my WS, is trying to use mdb file (through ODBC)

but probably the WS does not have permission to "touch" the mdb.

I hope i'm clear enough (sorry for my bad english).

Any help will be appreciated,

theSpringer.





Re: Visual C# General process does not execute

Citizen on the earth

Hi theSpringer,

Thanks for your update.

Did you mean "WS" for "Web Service" If you would like to run a process to access the mdb through a web service method, try to add "Network Service" account to the web service virtual dirctory and grant it read/write permission in IIS of windows server 2003.

Detailed steps as follows:

Input "inetmgr" in the "Run..." dialog of "Start" ->Click "OK" to open IIS ->right mouse click virtual directory of the web service ->"Permissions"->Add "Network Service" account and grant read/write permission

If this can't work for you, try to add Network Service" account to the mdb folder and grant read/write permission.

Detailed steps as follows:

right mouse click the folder of the mdb -> "Properties" -> tab "Security" ->Add "Network Service" account and grant read/write permission

If I have misunderstood you, please correct me. Thanks.

Citizens on the earth





Re: Visual C# General process does not execute

theSpringer

Hi Citizens on the earth,

Thanks for your help.

I did exactly as you recomend, but unfortunatly, nothing changed - i still can't run the exe from my web service.

I even created (dynamically) a bat file, and tried to run it, but no luck.

I also tried to run another exe (a simple sniffer) from my WS, with no success.

btw, if im double clicking the bat file manually, everything works fine.

I wonder, maybe it can't be run because the EXE open a commandShell (for 2 seconds, and then close it).

Maybe on a server side, there is no "reason" to run a gui application, because there are no clients to use it.

I don't know.....just guessing....

To overcome the problem, i created a service (Console application), that execute the exe file.

It works fine - but i would prefer to do it through the WS.

Thanks again for your help,

theSpringer.





Re: Visual C# General process does not execute

Citizen on the earth

Hi theSpringer,

Thanks for your update.

Did you deploy your Web Service to the IIS of Windows Server 2003 If yes, as far as I know, you can only start a exe as a background process in a web service, but cann't interact it with the desktop application(This is by design). You can check if the started exe is a backgroud process by Opening "Windows Task Manager"->Tab "Process". If this is true, the answer for you to start an exe through a web service and interact it with desktop seems NO.

If you have any questions about this, just let me know. Thanks.

Citizens on the earth





Re: Visual C# General process does not execute

theSpringer

Tnx for your quick reply.

Yes, i diployed my ws to the iis of windows server 2003.

When you say background process, do you mean thread with IsBackgroud property set to true

If no, how can i execute an exe as a background process

I cant see the process in the Task Manager, because it execute very fast (it compiles a file and finish - it takes less than a sec).

Thanks,

theSpringer/





Re: Visual C# General process does not execute

theSpringer

Tnx for your quick reply.

Yes, i diployed my ws to the iis of windows server 2003.

When you say background process, do you mean thread with IsBackgroud property set to true

If no, how can i execute an exe as a background process

I cant see the process in the Task Manager, because it execute very fast (it compiles a file and finish - it takes less than a sec).

Thanks,

theSpringer.





Re: Visual C# General process does not execute

Citizen on the earth

Hi theSpringer,

What I said "background process" means that if you start an exe in a web service using Process.Start method, it will be running at the background and you can't get it in GUI. Can you make sure the exe application executed in your web service Did you have any output from this exe application

As far as I know, there is not enough permission to execute an exe and interact with desktop application in IIS. I remember there is a work around in .NET 1.0 - http://support.microsoft.com/default.aspx scid=kb;en-us;555134, but this will not work .NET 2.0 or later.

My suggestion is that you'd better not start an exe application in a web service.

Hope this helps,

Regards,

Citizens on the earth





Re: Visual C# General process does not execute

theSpringer

Hi,

The exe is a "small" compiler - it takes a file as an argument and compiles it, so we get a new file (different extension).

So, when the exe is executed - you can see a new file being created.

I'll take your suggestion, and won't start the exe from the WS.

Many Thanks,

theSpringer.