从Web应用程序运行cmd命令 [英] To run cmd commands from web application

查看:669
本文介绍了从Web应用程序运行cmd命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 http://www.coolutils.com/CommandLine/ TotalCADConverter [ ^ ]用于将我的cad图像转换为常规图片文件。

当我的用户上传任何autocad文件时,我想从.net运行命令,它将为我进行转换然后我可以读取我转换后的文件。

我想在.net之下运行命令,当我直接从命令提示符运行时,它运行正常。

I want to use http://www.coolutils.com/CommandLine/TotalCADConverter[^] for converting my cad images to regular image files.
When my users upload any autocad file i would like to run the command from .net which will do the conversion for me and then i can read my converted file.
I want to run below command from .net, which works fine when i run directly from command prompt.

"C:\Program Files (x86)\TotalCADConverter\CADConverter.exe" "D:\DWG Images\arch2.dwg" "D:\DWG Images\arch2 (converted).svg"



当试图通过Web应用程序运行但无法弄清楚原因时,似乎有些安全问题。我的应用程序池中的设置标识已经尝试授予LocalSystem权限我的IIS服务。


Seems like some security issues when trying to run through web application but unable to figure out the reason.Tried setting identity of my application pool to "LocalSystem" also tried giving permission to my IIS service.

推荐答案

1.Simple您无法从Web应用程序执行此操作,因为Web应用程序在Web服务器上运行并且对系统的访问权限有限资源(例如,仅限于Web应用程序文件夹中的文件)。



2.一个解决方案可能是实现一个WCF服务来执行任务,然后你应该将WCF服务作为Windows服务托管到你的服务器中,你的Web应用程序将与WCF服务进行通信。
1.Simple you cannot do that from a web application, because the web application are running on the web server and has limited access to the system resources (for example only to the files from the web application folder).

2.One solution could be to implement a WCF service that will do the task, then you should host the WCF service as a windows service into your server, and your web application will communicate with the WCF service.


这篇关于从Web应用程序运行cmd命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆