If I have a asp.net web app on a windows box (obviously!), and I开发者_如何学Go need to execute a shell script that is on a linux server, is that possible?
How can I do this safely?
To build on what cxfx has said above your best bet might be to set up a web server on the linux box, and build a web service using, for example, php.
php allows you to run shell scripts - so by calling a web page runscript.php and then using exec (http://php.net/manual/en/function.exec.php) you could run the script.
Security is a consideration - you could restrict access to the linux web server purely to the IP address of the server hosting your asp.net site?
Hope that helps.
One way of doing it is by logging through ssh. You can use the granados C# library for it. This will let you run arbitrary commands. If what you need is to always run the same command, you can take a different approach like a CGI script (hide it with at least HTTPS and user/password).
Your best bet might be to expose the triggering of the shell script through some sort of web interface, like a secure web service.
精彩评论