如何解决状态代码500错误(打印作业进程已取消。)?

时间:2014-02-21 06:31:19

标签: c# asp.net pdf

我使用WebClientPrint 2.0从客户端的打印机自动打印pdf文件。 为此,我在我的项目中添加了Neodynamic.SDK.WebClientPrint.dll文件,并在我的系统中安装了WebClientPrintAspNet20.exe。 我试过这段代码http://www.neodynamic.com/articles/Print-PDF-from-ASP-NET-directly-to-default-printer-without-print-dialog/

但它不起作用,并给我错误:
(状态代码:500)打印作业流程已取消。

请给我建议解决此错误。

任何其他代码直接从客户端的打印机打印Pdf。

1 个答案:

答案 0 :(得分:0)

我们在ASP.NET应用程序中也使用它,最近我遇到了同样的错误。在我们的情况下发生了什么是WCP客户端无法连接到服务器处理程序,它抛出500.如果您使用处理程序(.ashx),如Neodynamic推荐给我们,我会检查web.config并确保有为处理程序正确定义的位置部分,即ashx文件,您省略或注释掉位置部分中的system.webServer部分,如下所示:

  <location path="Pages/NeodynamicWebClientPrint.ashx">
    <system.web>
        <authorization>
            <allow users="*"/>
        </authorization>
    </system.web>
    <!--system.webServer>
        <security>
            <authorization>
                <add accessType="Allow" users="*"/>
            </authorization>
        </security>
    </system.webServer-->
  </location>

出于故障排除的目的,尝试导航到处理程序的直接链接,例如:

https://www.ourdomain.com/OurApp/Pages/NeodynamicWebClientPrint.ashx

在位置设置编辑之前,我收到500错误,之后我能够导航并且Web客户端打印应用程序开始为我们工作。