【问题标题】:System.Diagnostics.Process.Start throwing threadabort exception on serverSystem.Diagnostics.Process.Start 在服务器上抛出 threadabort 异常
【发布时间】:2012-07-07 06:08:01
【问题描述】:

在我的网站中,我使用 System.Diagnostics.Process.Start 来预览特定文件。它在本地服务器上工作正常,但是当我尝试预览文件时,它在在线服务器上抛出 ThreadAbortException。

在中继器的按钮单击时发生预览。代码如下:

if (e.CommandName == "Preview")
            {
                Button btn = (Button)e.CommandSource;
                string filePath = Server.MapPath("~/Upload");
                string _DownloadableProductFileName = filename;
                System.Diagnostics.Process.Start(filePath + "\\" + _DownloadableProductFileName);
            }

【问题讨论】:

  • 请提供一些代码
  • 还要检查 IIS 设置,可能是权限问题。
  • @Naren 请重新检查编辑代码

标签: c# asp.net system.diagnostics threadabortexception


【解决方案1】:

要在 ASP.NET 服务器上使用 Process,您需要 configure the application for Full Trust.

您确定需要在服务器端生成此进程吗?看来你没有使用它的输出。

【讨论】:

  • 我只是想让用户预览文件内容而不下载它。
  • 这些是什么类型的文件?
  • microsoft office 文件:word、演示文稿等
猜你喜欢
  • 2023-03-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-03-11
  • 2013-12-02
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多