访问打印机'\\hercules\prtmark01'的设置无效 [英] Settings to access printer '\\hercules\prtmark01' are not valid

查看:915
本文介绍了访问打印机'\\hercules\prtmark01'的设置无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们最近将我们的Web应用程序从VS.Net 2003升级到VS.Net 2005和CR XIr2& CR 9.2。我们使用UNC路径中的ReportDoument类加载报告并调用PrintToPrinter方法。它适用于.Net 1.1& CR 9.2但带有.Net 2.0网络应用程序& CR XIr2我们收到以下错误:

异常详细信息:System.Drawing.Printing.InvalidPrinterException:访问打印机'\\hercules\prtmark01'的设置无效。

这里是我们用来加载报告并打印它的代码:

oRpt.Load("\\pegasus\reports\warehouse\batchheader.rpt")

         Dim crConnectionInfo作为ConnectionInfo
        Dim crDatabase As Database
        Dim crTables As Tables
        Dim crTable As Table
        Dim crTableLogOnInfo作为TableLogOnInfo

        crConnectionInfo =新的ConnectionInfo

       使用crConnectionInfo
          .ServerName ="***"       结果,          .DatabaseName ="***"   结果,          .UserID ="***"               结果,          .Password ="***"            结果,       结束与

        crDatabase = oRpt.Database
        crTables = crDatabase.Tables

       对于每个crTable中的crTables          crTableLogOnInfo = crTable.LogOnInfo
          crTableLogOnInfo.ConnectionInfo = crConnectionInfo
          crTable.ApplyLogOnInfo(crTableLogOnInfo),点击       下一页搜索结果        oRpt.SetParameterValue("Company",iComp)
        oRpt.SetParameterValue("CartBatchNbr",iCartBatchNbr)

       试着点击            oRpt.PrintOptions.PrinterName = sPrinter
            oRpt.PrintToPrinter(1,False,0,0)
        C ex ex As Exception
            sErr ="无法将批头标题发送到打印机"& sPrinter& ""。" &安培; vbCrLf& ex.Message结果           返回False
       最后点击            oRpt.Close(),点击       结束尝试

我可以得到.Net 2.0& 1.1 Web应用程序可以在Windows 2000 Server上运行,但只有.Net 1.1应用程序可以在Windows 2003 Server上运行。

任何帮助都将不胜感激。我们可能会打开一个支持案例。

解决方案

你有没有解决这个问题?升级到asp.net 2.0后,我们在Web服务器上遇到了完全相同的问题。在本地运行时,一切似乎都能正常工作,但是当从Web服务器调用PrintToPrinter时,我们会得到InvalidPrinterException。如果您对此有任何想法,我很乐意听到它们。感谢。

We recently upgraded our web application to VS.Net 2005 and CR XIr2 from VS.Net 2003 & CR 9.2. We load a report using the ReportDoument class from a UNC path and call the PrintToPrinter method. It works fine on .Net 1.1 & CR 9.2 but with the .Net 2.0 web app & CR XIr2 we get the following error:

Exception Details: System.Drawing.Printing.InvalidPrinterException: Settings to access printer '\\hercules\prtmark01' are not valid.

Here is the code we use to load the report and print it:

oRpt.Load("\\pegasus\reports\warehouse\batchheader.rpt")

        Dim crConnectionInfo As ConnectionInfo
        Dim crDatabase As Database
        Dim crTables As Tables
        Dim crTable As Table
        Dim crTableLogOnInfo As TableLogOnInfo

        crConnectionInfo = New ConnectionInfo

        With crConnectionInfo
          .ServerName = "***"       
          .DatabaseName = "***"   
          .UserID = "***"               
          .Password = "***"            
        End With

        crDatabase = oRpt.Database
        crTables = crDatabase.Tables

        For Each crTable In crTables
          crTableLogOnInfo = crTable.LogOnInfo
          crTableLogOnInfo.ConnectionInfo = crConnectionInfo
          crTable.ApplyLogOnInfo(crTableLogOnInfo)
        Next

        oRpt.SetParameterValue("Company", iComp)
        oRpt.SetParameterValue("CartBatchNbr", iCartBatchNbr)

        Try
            oRpt.PrintOptions.PrinterName = sPrinter
            oRpt.PrintToPrinter(1, False, 0, 0)
        Catch ex As Exception
            sErr = "Unable to send Batch Header to printer '" & sPrinter & "'." & vbCrLf & ex.Message
            Return False
        Finally
            oRpt.Close()
        End Try

I can get both the .Net 2.0 & 1.1 web app to work on a Windows 2000 Server but only the .Net 1.1 application works on Windows 2003 Server.

Any Help would be appreciated. We will probably be opening a support case.

解决方案

Did you ever get this issue resolved? After upgrading to asp.net 2.0, we're having the exact same issue on our web server. Everything seems to work fine when running locally, but we get the InvalidPrinterException when PrintToPrinter is called from the Web server. If you've got any ideas on this, I'd love to heard them. Thanks.


这篇关于访问打印机'\\hercules\prtmark01'的设置无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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