ASP.NET Process.Start在IIS8上不起作用(Windows 8.1) [英] ASP.NET Process.Start not working on IIS8 (Windows 8.1)

查看:128
本文介绍了ASP.NET Process.Start在IIS8上不起作用(Windows 8.1)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在过去的几天里,我一直在努力使这一工作正常进行,并尝试了所有建议的解决方案,包括此处的解决方案:

I've been trying to get this working for the past couple of days and tried every solution suggested including the one here:

System.Diagnostics.Process.Start无法从IIS

此代码(ASP.NET MVC Web应用程序)在IIS7(Windows 7)上完美运行.

This code (ASP.NET MVC Web Application) works perfectly on IIS7 (Windows 7).

该代码只需使用Adobe Reader从服务器在本地打印机(内联网)中打印PDF文件:

The code just print a PDF file using Adobe Reader in a local printer (intranet) from the server:

// print receipt
ProcessStartInfo psInfo = new ProcessStartInfo();
psInfo.FileName = acrobatReaderPath;
psInfo.WorkingDirectory = System.IO.Path.GetDirectoryName(psInfo.FileName);
psInfo.Arguments = String.Format("/s /o /h /t \"{0}\" \"{1}\"", filePath, printerName);
psInfo.WindowStyle = ProcessWindowStyle.Hidden;
psInfo.CreateNoWindow = true;
psInfo.UseShellExecute = true;
Process process = Process.Start(psInfo);

应用程序池标识是本地特权帐户.就像我之前说的,它可以在IIS7上运行.

The Application Pool Identity is a local privileged account. Like I said before, it works on IIS7.

奇怪的是,我可以在任务管理器(包括用于启动它的命令行)中看到后台进程已启动(AcroRd32.exe).如果我复制命令行并运行它,PDF不会出现问题.

The strange thing is that I can see the background process started (AcroRd32.exe) in the Task Manager including the Command Line used to launch it. If I copy the Command Line and run it the PDF prints without problem.

有什么我想念的吗?

我知道有更好的方法可以做到这一点.也欢迎提出建议.

I know there are better ways to do this. Suggestions are also welcome.

更新:

说明:问题是该过程尚未完成,PDF无法打印.

Clarification: The issue is that the process is not finishing and the PDF is not printing.

显然,问题出在一点点(32 vs 64).我还在调试.

Apparently the issue is more of a bitness (32 vs 64). I'm still debugging.

在以下情况下,代码正在打印 PDFs:

The code IS PRINTING the PDFs in the following scenarios:

  • Windows 7(64位)上的Visual Studio 2012 IIS Express
  • Windows Server 2008 Standard(32位)上的IIS7

在以下情况下,代码无法打印 PDF:

The code IS NOT PRINTING the PDFs in the following scenarios:

  • Windows 7(64位)上的Visual Studio 2012 IIS7
  • Windows 8.1上的IIS8(64位)

应用程序池正在使用管理员帐户运行,并且在高级设置"中将启用32位应用程序"设置为真".

The application pool is running with an Administrator account and the Enable 32-Bit Applications is set to True in Advance Settings.

万维网发布服务(W3SVC)在属性"中选中了允许服务与桌面交互".

The World Wide Web Publishing Service (W3SVC) has the Allow service to interact with desktop checked in the Properties.

请让我知道是否有人知道如何解决此问题.谢谢.

Please let me know if anyone knows how to solve this. Thanks.

推荐答案

已更改Foxit Reader的Acrobat Reader(

Changed Acrobat Reader for Foxit Reader (https://www.foxitsoftware.com/products/pdf-reader/) and it solved the problem. The command line is very similar.

这篇关于ASP.NET Process.Start在IIS8上不起作用(Windows 8.1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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