在IIS 7中部署后无法加载.PPTX

问题描述:

我有一个ASP.Net项目。当我通过VS 2010运行它时,我可以加载PPTX(PowerPoint)和PDF文件。在IIS 7中部署项目后,可以打开PPTX文件。打开.pptx的代码如下:

I have an ASP.Net project. When I run it through VS 2010, I can load PPTX (PowerPoint) and PDF files. After I deployed the project in an IIS 7, the PPTX file can' be opened. The code for opening a .pptx is below:

if (ext.ToUpper() == ".PPTX") {
   System.Diagnostics.Process.Start(sPath);  // sPath - address of the file
}



此外,我无法为IIS中部署的项目弹出Outlook电子邮件。

如何解决这个问题?谢谢。


Besides, I cannot pop out Outlook for email for the project deployed in IIS.
How can this problem be solved? Thanks.

Process.Start只会尝试在服务器上运行,这可能不会安装办公室。您更好的选择是通过响应对象或通过iframe链接文件以及让用户机器/默认首选项决定如何显示它来下载文件以供下载。



您可以在页面上放置一些可以从服务器加载文件的控件,使其看起来更加集成,但我总是有更好的运气只是给他们一个文件,让用户查看pptx或pdf然而他们习惯了。
Process.Start will only try to run on the server, which likely wont have office installed. Your better bet would bet to return the file for download either via the response object or by linking it through an iframe and letting the users machine/default prefs decide how to display it.

There may also be some control that you could put on your page that could load the file from the server so it appears more integrated but i've always had better luck just giving them a file and letting the user view the pptx or pdf however they're used to.