Click here to Skip to main content
15,566,522 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to install .exe from web application. when i run the application locally(from asp development server) it is installing properly. But when i hosted on IIS it is not working.

What I have tried:

string filepath = Server.MapPath("~/NewFolder1/Test.msi");

               ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('"+filepath+"')", true);
               System.Diagnostics.Process process = new System.Diagnostics.Process();
               System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
               startInfo.UseShellExecute = true;
               startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
               startInfo.FileName = "cmd.exe";
              // startInfo.Arguments = "/K msiexec.exe /i \"" + @"D:\Datta\CrispDoxCompression.msi" + "\" /quite /qn";
               startInfo.Arguments = "/K msiexec.exe /i \"" + filepath + "\" /qn";
               startInfo.Verb = "runas";
               process.StartInfo = startInfo;
               process.Start();
Posted
Updated 27-Feb-17 3:30am

Use the common sense, and tell me where is this file?
string filepath = Server.MapPath("~/NewFolder1/Test.msi");

Is it accessible locally? No. It is present on the server and the code, Process.Start() will be executed on the server as well. The client is barely the trigger in this case, and any action on the server-side will not tell him anything, and just as mentioned in Solution 1, the admins will also not let you execute an installer on their machine — by issuing a request.
Quote:
I am trying to install .exe from web application. when i run the application locally(from asp development server) it is installing properly.
Because, at that moment it will available on the same client machine, and things go well as you have the admin rights, and you know where the file is. That is why it works properly.
Quote:
But when i hosted on IIS it is not working.
No, application already was hosted using IIS (how else, would you run an ASP.NET application?) the only difference is that now your application is relying on the rights provided by hosting providers as well.

Never install an application, using an HTTP request, even if you know what is there. Most of the hosting service providers will believe it to be a malicious application and will immediately terminate the process, or worse, terminate the contract or subscription as well. The solution is, that you should contact the admins, or look at the add-ons provided in their control panel and select one from there. They will be happy with it, and your users will get the services as well.
 
Share this answer
 
Comments
dattaprasaddhuri 27-Feb-17 8:43am    
The File is in server. What i want is to install that msi/exe file on client machine silently like active x component
Afzaal Ahmad Zeeshan 27-Feb-17 9:12am    
Well, the browser will not let you install anything on client's machine. What you can do is download the installer and ask the user to manually trigger that installation. During that, the MSI should register itself as an ActiveX control handler and your application will start to work.

Browser will not let you make changes, to anything on the device. Also, the server-side code is left to the server-side and has nothing to do with the client-side.
Afzaal Ahmad Zeeshan 27-Feb-17 9:13am    
Also, please read this answer as well.
dattaprasaddhuri 1-Mar-17 3:22am    
@Afzaal Ahmad Zeeshan Is it Posiible to install the Activex control without user intervention
Afzaal Ahmad Zeeshan 1-Mar-17 7:03am    
You can build the ActiveX controls in the web application, but browser will always ask the user for permission to execute the internal code.
The error would tell you what the problem is but I can tell you without seeing the error that it is a permissions issue. If this is your server then grant the account running the IIS App pool sufficient permissions. If this is a hoster, you'll have to ask them but pretty sure the answer will be no.
 
Share this answer
 
Comments
dattaprasaddhuri 27-Feb-17 8:19am    
@RyanDev The Problem is that i am also not getting any error.
ZurdoDev 27-Feb-17 9:19am    
Seems hard to believe but possible. Regardless, the most likely cause is permissions.
dattaprasaddhuri 27-Feb-17 22:00pm    
@RyanDev I had given the proper permission. I had added the IUSER and give rights of fullControl to than application still it is not working
ZurdoDev 28-Feb-17 6:41am    
Wait a second, your comment in the other solution says, "What i want is to install that msi/exe file on client machine silently like active x component." You can't do that. That is a HUGE security risk and if it were possible then we'd all have viruses. You have to have client code execute to be able to do something like that.

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