asp.net如何调用服务器端exe文件 比如,我想通过IE打开放在服务器端的电子书exe文件,该如何解决. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 ASP.NET用户调用的exe,要没有界面的那种(用RAR解压文件是可以的)电子书exe,可能不行看看别人怎么说 不行的!!!IE只接收HTML代码做成activex还有可能 protected void Page_Load(object sender, EventArgs e) { } //调用可执行文件的方法 public void CallSteven() { string strCmd = ""; DateTime dt = DateTime.Now; //注意:需要引入System.Diagnostics; Process prc = new Process(); try { //指定调用的可执行文件 //strCmd += @"E:\Documents and Settings\Administrator\桌面\中国近代史.exe "; //如果可执行文件需要接收参数就加下下面这句,不同参数之间用空格隔开 //strCmd += 参数1 + " " + 参数2 + " " + 参数n; //调用cmd.exe在命令提示符下执行可执行文件 prc.StartInfo.FileName = Server.MapPath("中国近代史.exe"); //prc.StartInfo.Arguments = " /c " + strCmd; prc.StartInfo.UseShellExecute = false; prc.StartInfo.RedirectStandardError = true; prc.StartInfo.RedirectStandardOutput = true; prc.StartInfo.RedirectStandardInput = true; prc.StartInfo.CreateNoWindow = false; prc.Start(); } catch (Exception exU) { if (!prc.HasExited) { prc.Close(); } throw new Exception(exU.Message.ToString()); } } protected void Button1_Click(object sender, EventArgs e) { try { CallSteven(); lblMessage.Text = "完成调用"; lblMessage.ForeColor = System.Drawing.Color.Black; } catch (Exception exUpdate) { lblMessage.Text = exUpdate.Message.ToString(); lblMessage.ForeColor =System.Drawing.Color.Red; } }通过这个地址可以打开http://localhost:8985/WebForm1.aspx,但通过IIS http://serverd/WebUI/WebForm1.aspx打不开界面.进程里有 身份模拟,要有服务器端能够运行这个exe文件的权限 楼主说了打不开界面.进程里有本来IIS用户就是没有界面的用户。 哦,看来有界面的exe程序,asp.net里IE是不能直接调用服务器端的exe文件啦 楼主的描述不完整。你想:打开服务器端的电子书exe文件是为了干嘛? 网页中默认是打不开exe文件的,一般只能链接探出"运行"和"保存"的对话框,点击"运行"进行打开要想直接打开.exe文件只能通过自己开发active来实现 我想应该调用不了。逻辑上走不过去。你想在本地看,那IE上不会输出你的EXE文件内容吧 c#如何获得查询结果的某行某列值 怎么用gridview读取这个XML文件? 如何控制AJAX calendarextender控件的宽度和高度? 没分了,斗胆求教! DataList論壇的樓層怎麼做最好? 怎么解决,COOKIE保存中文乱码 页面跳转问题 求惠普的.net面试笔试题目,有用的就送100,总共送600分!!! 客户访问外网服务器IIS死锁,不在客户那测试IIS无压力 请教,怎么样才能让DataList 分几行显示,而不是全部挤在一行内? 关于两个数据库之间表复制的问题(在程序里实现C#) VS2003简单问题:对路径“D:\WIN...”的访问被拒绝
电子书exe,可能不行看看别人怎么说
{ } //调用可执行文件的方法
public void CallSteven()
{
string strCmd = "";
DateTime dt = DateTime.Now;
//注意:需要引入System.Diagnostics;
Process prc = new Process();
try
{
//指定调用的可执行文件
//strCmd += @"E:\Documents and Settings\Administrator\桌面\中国近代史.exe "; //如果可执行文件需要接收参数就加下下面这句,不同参数之间用空格隔开
//strCmd += 参数1 + " " + 参数2 + " " + 参数n; //调用cmd.exe在命令提示符下执行可执行文件
prc.StartInfo.FileName = Server.MapPath("中国近代史.exe");
//prc.StartInfo.Arguments = " /c " + strCmd;
prc.StartInfo.UseShellExecute = false;
prc.StartInfo.RedirectStandardError = true;
prc.StartInfo.RedirectStandardOutput = true;
prc.StartInfo.RedirectStandardInput = true;
prc.StartInfo.CreateNoWindow = false; prc.Start(); }
catch (Exception exU)
{
if (!prc.HasExited)
{
prc.Close();
} throw new Exception(exU.Message.ToString());
}
} protected void Button1_Click(object sender, EventArgs e)
{
try
{
CallSteven(); lblMessage.Text = "完成调用";
lblMessage.ForeColor = System.Drawing.Color.Black;
}
catch (Exception exUpdate)
{
lblMessage.Text = exUpdate.Message.ToString();
lblMessage.ForeColor =System.Drawing.Color.Red;
}
}
通过这个地址可以打开http://localhost:8985/WebForm1.aspx,但通过IIS http://serverd/WebUI/WebForm1.aspx打不开界面.进程里有
哦,看来有界面的exe程序,asp.net里IE是不能直接调用服务器端的exe文件啦
要想直接打开.exe文件只能通过自己开发active来实现
逻辑上走不过去。
你想在本地看,那IE上不会输出你的EXE文件内容吧