开发者

Can my asp.net application make a call to a linux server, speficially some shell script?

开发者 https://www.devze.com 2022-12-14 02:32 出处:网络
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?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消