帮助!!! System.Diagnostics.Process在IIS中不起作用 [英] Help!!! System.Diagnostics.Process not working in IIS

查看:561
本文介绍了帮助!!! System.Diagnostics.Process在IIS中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VS2010 C#并在具有本地IIS的本地Win 7上进行测试,我编写了一个Web服务以使用System.Diagnostics.Process.Start从计算机中打开一个文件.当我使用VS2010内置ASP.NET Development Server时,相同的代码确实起作用,但是当我使用IIS normal在Web服务上运行Process.Start时,它什么也没做

这是我的代码:

I am using VS2010 C# and testing on my local Win 7 with local IIS, I have wrote a web service to open one file from my computer, which use System.Diagnostics.Process.Start . The same codes did work when I use VS2010 build-in ASP.NET Development Server but when I use IIS normal to run Process.Start on the web service, it not doing anything

this is my code:

string path = @"D:\Data\Research\C-T-01_DotNet\Part 4 - C sharp Summary_v10.ppt";
 
Process proc = new Process();
proc.StartInfo = new ProcessStartInfo(path);
proc.Start();

推荐答案

您希望这样做吗?为什么要在服务器上打开Powerpoint? IIS以其自己的用户身份运行,它可能会在服务器上显示此信息(已延迟),但在其自己的帐户下.

几乎可以肯定,您的核心问题是您对ASP.NET以及服务器和客户端之间的区分一无所知,因为在测试计算机上运行代码时,它们是相同的.您可以将Powerpoint通过Response对象传递给客户端,以显示给客户端.
What do you expect this to do ? Why would you want to open a powerpoint on the server ? IIS runs as it''s own user, it''s probably showing this on the server ( which is retarded ) but under it''s own account.

Your core issue is almost certainly that you are clueless about ASP.NET and the division between server and client, because when you run your code on a test machine, they are the same. You pass your powerpoint through the Response object to show it to a client.


而不是进程启动,而应在单击事件时将文件传输给客户端.

或使用microsoft office interop,您可以将powerpoint文件转换为xps文件,可以在浏览器中轻松查看.
Instead of process start, you should transfer the file to client on click event.

Or using microsoft office interop , you can convert your powerpoint file to xps file, which can be easily viewed on browser.


我只想在单击asp.net网站上的事件时这样做,它将打开一个文件.
I just want to that when i click an event on asp.net website, it''ll open one file.


这篇关于帮助!!! System.Diagnostics.Process在IIS中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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