【问题标题】:Server Error in '/' Application. No printers are installed“/”应用程序中的服务器错误。没有安装打印机
【发布时间】:2015-07-03 20:12:40
【问题描述】:

“/”应用程序中的服务器错误。

没有安装打印机。

说明:在执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.Drawing.Printing.InvalidPrinterException:未安装打印机。

来源错误:

Line 166:              
Line 167:               
Line 168:                    rpt.PrintToPrinter(1, false, 0, 0);
Line 169:              
Line 170:                //Response.Redirect("~/SavingsAccountReg.aspx");

源文件:d:\inetpub\vhosts\atmnidhi.com\httpdocs\savingreport.aspx.cs 行:168

堆栈跟踪:

[InvalidPrinterException: No printers are installed.]
   System.Drawing.Printing.PrinterSettings.GetHdevmodeInternal(String printer) +199408
   System.Drawing.Printing.PrinterSettings.GetHdevmodeInternal() +28
   System.Drawing.Printing.PrinterSettings.GetHdevmode(PageSettings pageSettings) +48
   CrystalDecisions.CrystalReports.Engine.PrintOptions.CopyTo(PrinterSettings printer, PageSettings page) +322
   CrystalDecisions.CrystalReports.Engine.FormatEngine.PrintToPrinter(Int32 nCopies, Boolean collated, Int32 startPageN, Int32 endPageN) +176
   CrystalDecisions.CrystalReports.Engine.ReportDocument.PrintToPrinter(Int32 nCopies, Boolean collated, Int32 startPageN, Int32 endPageN) +73
   savingreport.btnsave_Click(Object sender, EventArgs e) in d:\inetpub\vhosts\atmnidhi.com\httpdocs\savingreport.aspx.cs:168
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9633962
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +103
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724

版本信息:Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.0.30319.34237

没有安装打印机。

说明:在执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详情:

System.Drawing.Printing.InvalidPrinterException:没有打印机 已安装。

【问题讨论】:

  • 如何解决这个错误

标签: c# asp.net


【解决方案1】:

如何解决这个错误

假设您确实打算允许网络请求导致连接到服务器的打印机打印出一些东西

  1. 确保为服务器配置了默认打印机
  2. 确保运行 Web 应用程序的身份有权访问打印机。

请注意,如果黑客获得了访问此网页的权限,他们可能会导致您使用大量纸张和墨水/墨粉 :-)

【讨论】:

  • 但我的应用程序不支持水晶报表查看器。但在本地系统中运行良好?那么我该如何解决这个问题呢?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-03-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多