从网站运行 .exe
我创建了一个 exe 文件,它在我的服务器上执行一些维护工作。 我希望能够从服务器上的网站启动它。 该 exe 必须在服务器本身上启动,而不是在客户端上启动。
我的直觉告诉我这是不可能的,但我必须和你们核实一下。
如果我需要设置某些权限/安全性 - 我可以。
I've created an exe file that does some maintainance work on my server.
I want to be able to launch it from the website that sits on the server.
The exe has to be launched on the server itself and not on the client.
My instincts tell me it's not possible but I've had to check with you guys.
If I need to set certain permissions / security - I can.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
是的,可以这样做,但不建议这样做。
运行维护脚本/可执行文件的理想解决方案是在 Unix/Linux 系统上使用 cron 或在 Windows 中使用计划任务来安排它们。与远程手动启动相比,自动化方法的一些优点:
Yes, it can be done, but it's not recommended.
An ideal solution for running maintenance scripts/executables is to schedule them using cron on Unix/Linux systems or using Scheduled Tasks in Windows. Some advantages of the automated approach vs. remote manual launch:
一个非常粗略的选项,假设 IIS:将执行访问从“仅脚本”或“无”更改为“脚本和可执行文件”
为了使这个不那么粗略,您应该让可执行文件实现 CGI 接口(如果它在您的控制之下)
。 ,如果您想使用 ASP.NET 添加授权/身份验证,则执行此操作的代码 (C#) 为:
A very crude option, Assuming IIS: Change Execute Access from "Scripts Only" or "None" to "Scripts and Executables"
To make this less crude, you should have the executable implement a CGI interface (if that is under your control.
And, if you want to use ASP.NET to add autorization/authentication, the code (C#) to do this would be:
这是可能的,但几乎可以肯定这是一个坏主意。什么环境/网络服务器?您应该只需要为该文件设置相关的“执行”权限。
不过,我真的建议您不要这样做,并将任务配置为在后台自动运行。原因是,如果配置不当,您最终可能会让人们运行任何可执行文件,并根据其他因素完全接管您的计算机。
It's possible, but almost certainly it's a bad idea. What environment/webserver? You should just need to set the relevant 'execute' permissions for the file.
I really suggest that you don't do this, however, and configure the task to run automatically in the background. The reasoning is that, configured badly, you could end up letting people run any executable, and depending on other factors, completely take over your machine.
取决于您使用的语言;大多数服务器端脚本语言都为您提供了执行 shell 命令的方法,例如:
从 perl 执行 unix 命令。
Depends what language you're using; most server side scripting languages give you a way to exectue shell commands, for example:
executed a unix command from perl.
大多数网络语言(我至少知道 Java 和 PHP)允许您从程序内执行命令行参数。
Most web languages (I know at least Java and PHP) allow you to execute a command line argument from within a program.