Click here to Skip to main content
15,886,666 members
Please Sign up or sign in to vote.
1.60/5 (3 votes)
See more:
Pls hlp us...
We have a .exe which we need to execute at the time an order is placed on a website. When we test this locally it works fine but When we move it to IIS7, it fails. How do we execute the .exe file ?
code:
C#
var fileprocess= new Process
                          {
                              StartInfo = new ProcessStartInfo
                                              {
                                                  FileName = exePath,
                                                  Arguments = arglist,
                                                  UserName = username,
                                                  Password = Password,
                                                  Domain = domain,
                                                  
                                                  UseShellExecute = false,
                                                  LoadUserProfile = true
                                              }
                          };

        fileprocess.Start();
        fileprocess.WaitForExit();
        fileprocess.Close();
Posted

You fail to run such exe as part of a web application because of security. While running on the development machine you are uder your own credentials, that most probably has administrator rights.
When under IIS you run under the context of the web site/application pool user, and that user mostly a week one with no rights like running exe.
You can change that user of course to one with proper right, but I suggest to rethink your design. There is no place for executable in a web application. It can lead a very huge security/resource/performance problem when your site goes alive! If your design tells you to use such exe your design is wrong...
 
Share this answer
 
Comments
sathishvegeta 14-Jul-14 2:31am    
How to give Admin rights to the user??
Kornfeld Eliyahu Peter 14-Jul-14 2:54am    
So you choose to go on the wrong path, after all...How pretty...
It's not a good idea to change the rights of the existing user, but replace with an other user with the proper right.
How to do it? Look for IIS help...
sathishvegeta 14-Jul-14 3:00am    
tks for reply ...i know its wrong but eventhough its helpfull for me ...
Kornfeld Eliyahu Peter 14-Jul-14 3:57am    
I'm aware of the pressure for a solution - I just want you know that next time you have to think in advance to not to get into such trouble...
Hi why don't you use javaScript to execute the exe on client machine. i am suggesting this because i have also faced the same problem. it was working fine in local machine but after hosting it was not working. It was showing in task bar but window was not visible.

check the link.

How to execute a Local File using HTML Application?[^]
 
Share this answer
 
Comments
Kornfeld Eliyahu Peter 14-Jul-14 3:56am    
And did you asked the owner of the computer if he agree to run any exe on his machine?
He does wrong, but you offer him a much worse option!!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900