Running .exe from a website

I created an exe file that does some maintenance work on my server. I want to be able to run it from a website that is located on a server. Exe should run on the server itself, and not on the client.

My instincts tell me this is not possible, but I had to check with you guys.

If I need to set certain permissions / security - I can.

+4
source share
5 answers

Very rude option. Assuming IIS: change access execution from “Scripts only” or “No” to “Scripts and executables”

To make this less rude, you must have an executable file to implement the CGI interface (if this is under your control.

And, if you want to use ASP.NET to add authorization / authentication, for this code (C #) would be:

System.Diagnostics.Process process; var startInfo = New System.Diagnostics.ProcessStartInfo("C:\file.exe") process.StartInfo = startInfo; process.Start(); process.WaitForExit(); 
+1
source

Yes, it can be done, but it is not recommended.

The ideal solution for running maintenance scripts / executables is to schedule them using cron on Unix / Linux systems or using scheduled tasks on Windows. Some of the advantages of the automatic approach to remote manual start:

  • The server computer is self-sustaining. Customers may fail and people may forget. While the server is running, the server will keep itself updated, regardless of the state of the client machines or persons.
  • When will the executable be launched? Every time a particular page is viewed? What if the page is refreshed? For a resource-intensive script / executable, this can seriously degrade server performance. You will need to code the rules to process multiple requests and monitor ongoing maintenance processes. Cron and scheduled tasks already cope with these features.
+3
source

It is possible, but almost certainly it is a bad idea. What is the environment / web server? You just need to set the appropriate execute permissions for the file.

I really suggest that you do not, and set up a task to run automatically in the background. The reason is that if configured poorly, you can ultimately allow people to run any executable file and, depending on other factors, completely take over your machine.

+1
source

Depends on which language you use; most server-side scripting languages ​​give you a way to invoke shell commands, for example:

 $result=`wc -l /etc/passwd`; 

executed the unix command from perl.

+1
source

Most web languages ​​(I know at least Java and PHP) allow you to execute a command line argument from a program.

0
source

All Articles